[CMake] How to specify that a target link library is shared ?
Andy Lego
andy at legoandy.com
Tue Oct 7 15:05:37 EDT 2008
Hello,
The def file was always a bit of a mystery to me, since you do not specify
it on the command line but the linker just finds it magically. I much prefer
the import/export mechanism.
Here is what I typically did when I still did some Win32 programming:
Add the following code in your header file:
#if defined(_WIN32)
#if defined(mylib_EXPORTS)
#define MYLIB_EXPORT __declspec( dllexport )
#else
#define MYLIB_EXPORT __declspec( dllimport )
#endif
#else
#define MYLIB_EXPORT
#endif
Then every symbol you want to use outside the shared lib export like this:
class MYLIB_EXPORT someClass {
...
};
and
MYLIB_EXPORT void someFunc();
and so on.
Hope this helps.
Andy
On Tue, Oct 7, 2008 at 11:25 AM, Andrea Borsic
<Andrea.Borsic at dartmouth.edu>wrote:
> Hi All,
>
> Yes it is the .def file that defines the import/exports, but the linking
> stage fails before taking care of these aspects: it looks for
> triagle_lib.lib which is not there and stops before considering symbol
> resolutions.
>
> Thanks for your help, I will be reading all the emails that came in,
>
> Regards,
>
> Andrea
>
>
>
> Joshua L. Blocher wrote:
>
>> Isn't the def files the defines the export symbols.
>>
>> Boudewijn Rempt wrote:
>>
>>> On Tue, 7 Oct 2008, Andrea Borsic wrote:
>>>
>>>
>>>
>>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
--
Lets bike the world together
http://legoandy.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081007/a738ec39/attachment.htm>
More information about the CMake
mailing list