[xsd-users] gcc visibility, serializer-map and typeinfo

Benjamin Schindler bschindler at inf.ethz.ch
Thu Jun 24 03:59:27 EDT 2010


Hi

Since we switched to xsd-3.3, I wanted to turn on gcc-visibility default
to hidden (which is recommended usually). However, I got stomped by a
problem in the type-serializer-map.hxx

The problem is that the type_map of type_serializer_map stores pointers
to type_id structs. These type_info structs seem to have different
addresses when compiled with --visbility=hidden in different shared
objects. Some light on this issue is shed on in this faq entry:
http://gcc.gnu.org/faq.html#dso

The problem manifests this way: When my object to be serialized is
created in the so's loaded at startup time, it works. The xsd is
compiled into dataflow.so, and the object is created and serialized in
server.so and it works fine.

However, it does not work, when I create the xsd object in a plugin
(i.e. a dlopened library) and serialize it in server.so. I get the
exception thrown on type-serializer-map.txx:344.
I don't know whether it would work when I'd serialize it in the dlopened
lib itself - might work, but I'm not too familiar with the xsd internals.

Please also note that I added -E to my ldflags a long time ago to make
rtti work across shared object files as noted in the link above.

I don't really know what kind of solution to propose.
-fvisibility=hidden is really recommended for compilation of any shared
object file on linux

Cheers
Benjamin



More information about the xsd-users mailing list