[CMake] Exporting functions from DLLs using standard calling conventions

Phillip Hellewell sshock at gmail.com
Sat Apr 15 02:15:56 EDT 2006


On 4/14/06, Ben Larson <blarson at optomet.com> wrote:
>
> Hello,
>
> I'm using CMake to manage the build process for a DLL I've created
> mostly from ITK. I have successfully accessed the DLL with a C++ app but
> now want to export the functions using standard calling conventions so I
> can call the DLL from a Visual Basic app. I've got __stdcall in front of
> all of my functions but Visual Studio 6 doesn't seem to be exporting
> them correctly. Configuring a project entirely within VS 6 exports fine
> with __stdcall but the projects with CMake are not. I'm sure I'm missing
> something here. I'm wondering if there are some settings I need to set
> in the CMakeLists.txt file to make sure I'm creating DLLs that are
> exporting functions with standard calling conventions.


Maybe it is not a CMake issue at all.  Here are a couple of things I would
check:
1. Use extern "C" on the functions you want to export
2. Create an appropriate .def file and add it to your project

Phillip Hellewell
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060415/67f56271/attachment.html


More information about the CMake mailing list