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



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.

Any other ideas?

Regards,
 Niklas.

-- 
Niklas Grossmann
Start Amadeus GmbH
System Platforms - Middleware Services T-SM
Marienbader Platz 1, 61348 Bad Homburg v.d.H.

 




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