tags:

views:

58

answers:

1

I have a Qt application which uses Q_DECL_EXPORT to mark certain data types and functions of my main executable as exported. Likewise, when I compile my plugins, I mark those same symbols with Q_DECL_IMPORT to import them.

This has worked great on linux. All I need to do is compile with -rdynamic and it goes well. Visual Studio 2008 has been good to me as well, it happily creates a .lib file for my main execuable, I simply link my plugins to that .lib and it now knows that those symbols will be found in the main application when the plugin is loaded.

MingW on the other hand is proving to be not so much fun. The main application as expected compiles without a hitch. But the plugins all fail during link time due to "undefined reference" error all of course starting with _imp__. Is there a way to get MingW to ignore these errors since I know they will be resolved when properly loaded?

I have tried flags such as -Wl,--unresolved-symbols=ignore-all and -Wl,--allow-shlib-undefined to no avail.

I would like to add MingW to the list of supported compilers, but I can't seem to get this one part to work. Surely I am not the first person to want to have a plugin which imports symbols from the application it is being loaded into!

A: 

When linking with MingW do you link your plugins against the main executable .lib as you do with Visual Studio?

Maxim Yegorushkin
MingW doesn't produce a `.lib` for my main executable like visual studio does, otherwise I would.
Evan Teran
Silly question, but do you pass a flag to produce .lib when you link your binary with MingW?
Maxim Yegorushkin
Does such a flag exist? If so, do you know what it is?
Evan Teran