[Insight-users] [CMake] Building shared libs on visual
Julien Michel
julien.michel at c-s.cnes.fr
Wed Sep 24 05:46:24 EDT 2008
Werner Smekal a écrit :
> Hi,
>
> maybe you forgot to export symbols?
>
> http://www.cmake.org/Wiki/BuildingWinDLL
Dear Werner,
Thank you, I did search the cmake Wiki for something like that, but I
did not manage to find this page. I think we are exporting/importing our
symbols in most of the case, but I did not know that visual will simply
not build any dll if there is no exported symbol.
This lead me to another question:
In the wiki page, it is suggested to do the following:
#if defined (_WIN32)
#if defined(MyLibrary_EXPORTS)
#define MYLIB_EXPORT __declspec(dllexport)
#else
#define MYLIB_EXPORT __declspec(dllimport)
#endif /* MyLibrary_EXPORTS */
#else /* defined (_WIN32) */
#define MYLIB_EXPORT
#endif
But in this piece of code, the case were we build static libraries under
windows is not handled. This means that we will import/export symbols
even if we build static libraries, and this seems to break the
compilation, leading to "undefine reference to declspec(dllimport) xxx"
when trying to link against the library. I did look at the export
sections of other libraries and they seem to handle this static case by
removing the __declspec(dllexport)/__declspec(dllimport). What is the
right thing to do here ?
Thank you for your reply,
Best regards,
Julien
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Julien MICHEL - Ingénieur d'études - Traitement d'images
CS Systèmes d'Information - Division ESPACE
Département Information Géographique & Image
Téléphone : +33 561 17 64 27
Email : julien.michel at c-s.fr
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Insight-users
mailing list