tags:

views:

16

answers:

1

Hello,

I'm developing a Qt application, a core system and plugins to extend the core.

In plugins I am using objects compiled in the main binary. Under GNU/Linux (Fedora 13 and Debian 5.06) there is no problems. I even don't need to link the plugin with Qt, all Qt's objects are instantiated from the main binary. But under Windows, when linking the plugin, the compiler cannot find symbols corresponding to these objects from the main binary and then the compilation crashes.

Is it because that's not possible under windows or maybe I missed something ?

Thanks

PS: I'm using CMake.

A: 

Under GNU/Linux CMake added -rdynamic.

Under Windows mingw32 don't take the -rdyamic option. So we have to export all symbols to a static library and link plugins with it.

Put this to the core application project file:

linux-g++:LIBS += -rdynamic
win32-g++:LIBS += -Wl,--export-all-symbols,--out-implib,lib${TARGET}.a

And this to each plugins project files:

win32-g++:LIBS += -LPATH_TO_CORE_SYMBOLS_LIB -lCORE_SYMBOLS_LIB_NAME

++

François