[CMake] CMake and def files

Totte Karlsson totte at dunescientific.com
Sat Jan 4 17:26:20 EST 2014


Hi
I'm creating a DLL using the borland compiler. Using the __cdecl 
convention with borland generate exported functions with a "_" prefix on 
each exported function (nuisance).

In the Borland IDE, I can add a .def file and alias these, to names 
without the "_" prefix, e.g.
.def file
LIBRARY     mylib.dll

EXPORTS
func1 = _func1
func2 = _func2

causing the resulting DLL to have both _func1 and func1 available, as I 
can see with a dll export viewer.

When I build the dll using CMAKE, however, even after adding the .def 
file, the resulting dll don't have the aliased names.

I have tried adding the def file to sources, but that seem no to work, 
and setting the module linker flags, e.g.
     set (CMAKE_MODULE_LINKER_FLAGS   "${CMAKE_MODULE_LINKER_FLAGS} 
\"/DEF:${CMAKE_CURRENT_SOURCE_DIR}/myllib.def\"")

is not doing it either.

Anyone knowing how to do it properly?

-totte


-- 
.........................
Totte Karlsson, Ph.D.
Dune Scientific, LLC
425-296 1980 (office)
425-780 9648 (cell)
www.dunescientific.com
.........................



More information about the CMake mailing list