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

Benjamin Schindler bschindler at inf.ethz.ch
Fri Jun 25 09:58:11 EDT 2010


Hi Boris

On 06/25/2010 05:41 PM, Boris Kolpackov wrote:
> Hi Benjamin,
> 
> Benjamin Schindler <bschindler at inf.ethz.ch> writes:
>  
>> If I have a template class like this:
>>
>> template<typename T>
>> class Bla {
>> // some code
>> };
>>
>> and I instantiate this template in different dso's, the template will be
>> instantiated in each dso with visibility=hidden and they therefore get
>> their own type_info object. This problem does not occur with the stl as
>> they declare their namespaces like this:
>>
>> _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) which expands to
>>
>> namespace std __attribute__ ((__visibility__ ("default"))) {
>>
>> This means, that the template type gets exported and the type_info
>> object get correctly merged. 
> 
> Interesting.
> 
> 
>> I'll let it up to you to decide what and how you would like to export 
>> your stuff. as little as possible is always a good thing, but since 
>> libxsd is template only, it might make sense to export the entire 
>> namespace may be
> 
> Actually, there is way to export the individual template instantiations
> that make up the xml_schema namespace. See the description for the
> --export-xml-schema option. Your util.dll looks like a good place
> to do this.

That's interesting. I just tried that but I get huge amounts of warnings
when I compile my code now. The problem is this:

When I compile utils, all is fine and there is one Schema with the
--export-xml-schema option that has all of the export symbols. However,
when I compile other code, I get a lot of warnings:
type attributes ignored after type is already defined (for example for

template class UTILS_DLL exception< char >;

The problem seems to be that I include another Schema, which is compiled
with this option: --extern-xml-schema "Schema.h". Probably, the files
get included before schema.h and this is why I get these warnings. Do
you have another trick in your sleeve to get around this, am I doing
something wrong or is this a bug?

Cheers
Benjamin

> Boris



More information about the xsd-users mailing list