[Qgis-developer] Qgis plugin and typeid issues

John C. Tull jctull at gmail.com
Mon Aug 23 18:51:13 EDT 2010


Hi Emmanuel,

Looks like my chronological review of email caused me to miss this.

Good luck,
John

On Aug 23, 2010, at 2:33 AM, Emmanuel Christophe wrote:

> Hi all,
> 
> (sorry for double posting, the developer list seems more appropriate)
> 
> I'm working on the OTB (www.orfeo-toolbox.org) Qgis plugins: the
> objective is to provide more raster processing capabilities to Qgis.
> I run into a tricky C++ issue. In one particular case, one typeid
> resolution does not seems to work. I believe that it is linked with
> the issue mentioned here:
> 
> http://gcc.gnu.org/faq.html#dso
> dynamic_cast, throw, typeid don't work with shared libraries
> 
> (I'm currently working with gcc and trying to make it work with shared
> libraries).
> 
> What make me think that this is linked to this issue is that:
> - the plugin is loaded using dlopen by qgis
> - the typeid is created by some code compiled in the plugin (OTB uses
> templates extensively, so this particular piece of OTB code is
> compiled during the plugin compilation) and the resulting type_info is
> passed to another dynamic library that was compiled before (during OTB
> compilation).
> 
> So it seems that we are in the third case mentioned by the FAQ. In
> this situation, the FAQ recommend to
> "First, export global symbols from the executable by linking it with
> the "-E" flag. You must also make the external symbols in the loaded
> library available for subsequent libraries by providing the
> RTLD_GLOBAL flag to dlopen. The symbol resolution can be immediate or
> lazy."
> 
> The RTLD_GLOBAL flag seems to be provided
> (src/app/qgspluginmanager.cpp:256), but I'm not sure about the -E flag
> while linking. Can anybody with more experience in Qgis compilation
> confirm?
> 
> Is there any other plugin I should look at for inspiration?
> 
> Emmanuel
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer



More information about the Qgis-developer mailing list