RE: [libxml++] Compiling with Solaris C++ compiler



> From: Grossmann Niklas [mailto:Niklas Grossmann START de] 
> 
> Hi,
> 
> I tried to compile the libxml++ 0.24.0 on Solaris using Sun' 
> s C++ compiler
> (version 5.2). This compiler distinguishes between C++ linking and C
> linking, e.g. 
> extern "C" void foo();
> and pointers to such functions are something different than 
> extern "C++" void foo();
> 
> Thus the assignments like (parser.cc, line 49):
> _context->vctxt.error = &_callback_validity_error;
> do not work since error is a pointer to a C function (defined 
> in libxml2)
> and _callback_validity_error is a static C++ method of Parser.
> 
> I came up with three possible solutions but I do not like any of them:
> 1. add extern "C" {...} blocks around class Parser {...}; and 
> all other
> classes where this problem occurres. I have not tested this.
> 2. for each method which has to be assigned to a C pointer 
> add an function
> defined with C linking which then calls the C++ method:
> 	extern "C" void foo_helper();
> 	
> 	void foo_helper()
> 	{
> 		ClassName::foo();
> 	}
> 
> 3. use gcc.

This is a generic issue. None of these solutions should be necessary. gtkmm
builds with SUN's Forte compiler on Solaris, so you should be able to find a
solution. For instance, you might look at code such as this:
http://cvs.gnome.org/lxr/source/gtkmm-root/gtk-src/treeview.ccg#325

Murray Cumming
murrayc usa net
www.murrayc.com 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]