[CMake] shared libraries .lib .dll
Pierre Malarme
pmalarme at ulb.ac.be
Thu Jun 19 11:37:34 EDT 2008
hi,
i've taken your advice on the __declspec stuff and test it on a hello
world project. i do have a .lib now but with a warning
"
hello.cxx
..\..\CMakeExample\Hello\hello.cxx(5) : warning C4273:
'Hello::Print' : inconsistent dll linkage
h:\workspace\cmakeexample\cmakeexample\hello\hello.h(18) : see
previous definition of 'Print'
is that normal? anyway there is a problem: the application fail to
find the .exe and the .dll though i fixed those paths in the
CMakeLists.txt.
what could be the problem?
thanks for help
Ingrid
2008/6/10 Martin Apel <martin.apel at simpack.de>:
Ingrid Kemgoum wrote:
hi and sorry to disturb
(i'm french and my english is not that good)
but i've seen on cmake.org <http://cmake.org> that i'm having the same
problem as you did.
i'm building a c++ project and from a shared library i only have
the .dll (not the .lib)
i dont understand explanations on cmake so could you please give me
some?
thanks in advance and regards
Ingrid
Hi Ingrid,
on Windows you have to tell the compiler/linker, which symbols should
be exported from a DLL. There is a Microsoft extension to C++
using a declspec(export) and declspec(import) prefix for DLL
functions. There's another possibility to use a so-called .def-file to
tell the compiler,
which symbols to export. If you have not told the compiler using one
of the two ways, no symbols are exported and thus no .lib file
generated.
Please google for the explanation of the declspec keyword, it is
somewhat beyond my available time to explain it in detail. What I did
looks roughly as follows:
#ifdef WIN32
#ifdef Base_EXPORTS
#define SPCK_BASE_EXPORT __declspec(dllexport)
#else
#define SPCK_BASE_EXPORT __declspec(dllimport)
#endif
#else
#define SPCK_BASE_EXPORT
#endif
class SPCK_BASE_EXPORT Transformer
{
...
};
Hope this helps,
Martin
--
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080619/b603eb4a/attachment-0001.htm>
More information about the CMake
mailing list