Hello Thomas,

On 07/05/2011 05:54 AM, Henn, Thomas wrote:
> I currently face an issue with gcc's compiler option -fvisibility=hidden. 
> When I try to compile my OpenSG executable with that option, the resulting 
> program shows a very strange behavior. For example, if I try to create a 
> geometry like this...
>
>    GeoPositions3fPtr pos = GeoPositions3f::create();
>    beginEditCP(pos);
>    [...]
>    endEditCP(pos);
>
>    [...]
>
>    GeometryPtr geo = Geometry::create();
>    beginEditCP(geo);
>    geo->setPositions(pos);
>    [...]
>    endEditCP(geo);
>
> ...each GeoProperty<T>::create() returns NullFC and only Geometry::create() 
> returns a valid pointer. But when I create a SimpleGeometry like this...

just to clarify: you wrote GeoProperty<T>::create(), but your code is 
not actually using the templates directly, but GeoPositions3f::create(), 
GeoNormals3f::create(), etc., like the snippet you posted above, right?

>    GeometryPtr geo = makeTorusGeo(0.5,4,8,16);
>
> ...everything works fine.
> But I don't really understand why my first approach doesn't work.

hmm, I'm not sure what the problem could be either. As a first check, 
can you start your program with environment variable OSG_LOG_LEVEL=DEBUG 
set? You should see many lines of the form:

DEBUG:  Registered type Geometry | 735 (-1645862464)
DEBUG:  Registered type GeometryPtr | 736 (-1645862208)
DEBUG:  Registered type SFGeometryPtr | 737 (-1645862112)
DEBUG:  Initialized FieldType : SFGeometryPtr 0x7f729de62320
DEBUG:  Registered type MFGeometryPtr | 738 (-1645861984)
DEBUG:  Initialized FieldType : MFGeometryPtr 0x7f729de623a0

Can you check if the GeoProperties you are using (e.g. GeoPositions3f) 
show up as registered types?
Perhaps you can also compare the output of your program with that of one 
of the test/tutorial programs that come with OpenSG, e.g. 
testStatisticsRender.

> Another question is, whether it is possible to compile OpenSG itself with 
> -fvisibility=hidden and how the OpenSG sources have to be modified for that.

I imagine at the very least one would have to go through an annotate all 
types that are meant to be visible to applications linking with OpenSG. 
Perhaps the macros used for adding dllexport/dllimport on windows can be 
used for that.
I wouldn't expect too much of an effect though, since the majority of 
types are meant to be used by applications (e.g. practically all 
FieldContainer should be visible) so only few types would actually end 
up being hidden.

> Would this solve my above problem too?

Not sure, I haven't really used -fvisibility=hidden and I'm not sure 
what exactly is causing the problem you are seeing ;)

        Cheers,
                Carsten

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Opensg-users mailing list
Opensg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to