Boost logo

Boost :

From: Christoph Ludwig (cludwig_at_[hidden])
Date: 2004-08-12 14:18:44


working with the post-review version #20 of the serialization library,
I encountered problems with respect to the export macros
(BOOST_CLASS_EXPORT_GUID etc.). I decided to check the Boost CVS for
changes - but it turns out the problems became worse :-(

(FWIW, I use gcc 3.4.1 on a Linux x86 machine.)

I need to register class template specializations that have several
arguments. Unfortunately, the preprocessor does not know about
template argument lists and treats the 2nd, 3rd,... template argument as
separate macro arguments. Therefore, the expansion of the export
macros fails due to a wrong number of macro arguments.

It does not help to surround the template-id with parentheses since
after the macro expansion the argument is used as a template argument
itself and the compiler rejects the "superfluous" parentheses in the
new template argument list.

With serialization#20 I had the workaround to define a typedef for the
template specialization within an anonymous namespace. I could then
pass this typedef to the export macros. But this approach becomes soon
impractical if you write a library with internal class templates
depending on some user defined types.

Does anyone know a work around that does not need the typedefs? I had
a look at the preprocessor library but I couldnt come up with a
solution. Is there an alternative to the macros for registering types?
(A sample program exhibiting what I am trying is attached.)

Anyway, with the current CVS, even above mentioned workaround fails;
I am going to discuss the reason in a separate posting.



Boost list run by bdawes at, gregod at, cpdaniel at, john at