Hi Stephan,

Thanks for the explanation, you learn something new everyday :-)

Incompatibility like this I'd personally put down as a bug in the
design/implementation rather than a "feature".  I am curious why we
haven't seen this particular issue more often.  If the visibility of
classes is hidden by default then we should be seeing these issues
between OSG libs and applications all the time - for instance the code
almost identical that that Philip is using is used in osgPresentation
with it doing dynamic_cast<> on objects provided by the core osg lib.

The question next is really what to do about the issue.  Just document
the bug and it's workaround - changing symbol visibility via compiler
options or do we change the OSG itself so it by default doesn't hide
visibility of symbols.

Robert.

On 7 February 2013 12:10, Stephan Huber <[email protected]> wrote:
> Hi Robert,
>
> this is not a compiler bug, this is by design. gcc compares instances of
> classes by the pointer to its vtable. (Visual Studio uses a
> string-comparision) If you define a class in a shared library and use it in
> your app there are chances that you end up with two vtables of a class, one
> in the app, one in the lib. If you don't setup proper symbol visibility of
> your methods the linker does not have a chance to "see" the two identical
> classes and merge them.
>
> And this affects gcc >= 4.0 (don't know about clang)
>
> More info here: http://gcc.gnu.org/wiki/Visibility especially Problems with
> C++ exceptions (please read!)
>
> Xcode defaults to hide symbols when creating a new project, that's all.
>
> cheers,
> Stephan
>
>
> Am 07.02.13 11:48, schrieb Robert Osfield:
>>
>> Hi Stephan,
>>
>> On 7 February 2013 10:43, Stephan Huber <[email protected]> wrote:
>>>
>>> this worked for me in the past: check your project settings,  "Symbols
>>> hidden By default" should be deactivated for both osg and your project.
>>
>> Is this a workaround for a bug in the compiler or is it some obscure
>> way of enabling proper RTTI support?
>>
>> Should we be adding this as an option by default for the LLVM compiler?
>>
>> Robert.
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to