I'm the new one in cb from vs2010.The cb svn I have been using is 10050.Everything is fine except I can't use .def file to define a .dll file.
I have read all of the topics carefully about this problem,such as (http://forums.codeblocks.org/index.php/topic,14812.msg99253.html#msg99253
http://forums.codeblocks.org/index.php/topic,10559.msg72397.html#msg72397
http://forums.codeblocks.org/index.php/topic,14285.msg96045.html#msg96045
http://forums.codeblocks.org/index.php/topic,8236.msg61186.html#msg61186
http://forums.codeblocks.org/index.php/topic,8967.msg64716.html#msg64716
http://forums.codeblocks.org/index.php/topic,10882.msg74368.html#msg74368
http://forums.codeblocks.org/index.php/topic,2616.msg20703.html#msg20703
).But they did not solve my problem.so thanks to someone to tell me How to configure C::B to use DEF file when creating DLL?
test code :
main.cpp:
int __stdcall Add(int numa, int numb)
{
return (numa + numb);
}
int __stdcall Sub(int numa, int numb)
{
return (numa - numb);
}
main.def
LIBRARY test
EXPORTS
Add @ 1
Sub @ 2
the project options
(http://i1058.photobucket.com/albums/t406/manceb/1_zps0a3beaa4.png)
(http://i1058.photobucket.com/albums/t406/manceb/2_zps772a1d20.png)
(http://i1058.photobucket.com/albums/t406/manceb/3_zps424141e7.png)
the other linker options and errors.
(http://i1058.photobucket.com/albums/t406/manceb/47_zps151b1529.png)
(http://i1058.photobucket.com/albums/t406/manceb/46_zpsca04ea66.png)
(http://i1058.photobucket.com/albums/t406/manceb/44_zps3334d612.jpg)
(http://i1058.photobucket.com/albums/t406/manceb/41_zps21120634.png)
(http://i1058.photobucket.com/albums/t406/manceb/45_zps71f6a463.png)
(http://i1058.photobucket.com/albums/t406/manceb/42_zps6d0226f7.png)
I'd appreciate any reply
As you can clearly see in the output the option "--def" is not supported by gcc...
are you ever planing to go back to msvc?
if not, why are you using def files and not simply use "__declspec(dllexport)" in your source? (http://stackoverflow.com/a/21902439)
i don't know any option for gcc to use def files, and this is also no gcc support forum. It is a c::b support forum, so if you find a option to use def files with gcc and want to know how to use it with c::b then we can help you better...
PS.: i searched a bit and according some sites you need to use a thirparty tool to use def files with gcc: http://www.boyunjian.com/do/article/snapshot.do?uid=1013034473452214461
so you need a post build step to make your dlls. You can make a post build step in Project->Build Options ->Pre/Post build steps->Post build step.
The Variables you can use in this post build steps are described here: http://wiki.codeblocks.org/index.php?title=Variable_expansion
so you need a postbuild line like this (no waranty, i can't test it, because no windows, and also not a expert with this kind of sorcery )
dllwrap -o $(TARGET_OUTPUT_BASENAME).dll --driver-name c++ --def DEF_FILE $(TARGET_OBJECT_DIR)\$(TARGET_OUTPUT_BASENAME).o $(TARGET_OUTPUT_FILE) -Wl,--enable-stdcall-fixup