From: Speed D. <no...@so...> - 2010-06-19 07:45:16
|
#134: Fed up with the .def files to define the DLL/static lib interfaces under Windows ------------------------------------+--------------------------------------- Reporter: pouillot | Owner: pouillot Type: task | Status: new Priority: major | Milestone: 2.0.0 Component: Build system | Version: 2.0.0-dev Keywords: DLL export Windows def | ------------------------------------+--------------------------------------- Description changed by pouillot: Old description: > Each time you add an exported function from one of our DLLs (tgf, > tgfclient, ...), you have to add a new line for it in the associated .def > file ... otherwise it won't be exported by the DLL uunder Windows. > > They can all be removed, except for the robots' ones (which are > generated), through the following technique : > 1. in the .h where the exported functions are declared, replace the > "extern" keyword by the <DLL name>_API macro defined that way (example > for tgfclient) : > {{{ > #ifdef WIN32 > # ifdef TGFCLIENT_DLL > # define TGFCLIENT_API __declspec(dllexport) > # else > # define TGFCLIENT_API __declspec(dllimport) > # endif > #else > # define TGFCLIENT_API > #endif > }}} > > 2. Add the <DLL name>_DLL define in the DLL CMakeLists.txt > > If noone has any objection (robot developers with a C-only compiler ?), > I'll apply this everywhere soon (once again : except for the robots). New description: Each time you add an exported function from one of our DLLs or static libs (tgf, tgfclient, ...), you have to add a new line for it in the associated .def file ... otherwise it won't be exported by the DLL uunder Windows. They can all be removed, except for the robots' ones (which are generated), if we move all static libs to shared = DLL ones ; through the following technique : 1. in the .h where the exported functions are declared, replace the "extern" keyword by the <DLL name>_API macro defined that way (example for tgfclient) : {{{ #ifdef WIN32 # ifdef TGFCLIENT_DLL # define TGFCLIENT_API __declspec(dllexport) # else # define TGFCLIENT_API __declspec(dllimport) # endif #else # define TGFCLIENT_API #endif }}} 2. Add the <DLL name>_DLL define in the DLL CMakeLists.txt That way, we'd also fix the static/shared libs unconsistency in the build system (under Windows, many libs are static ones, whereas they are all shared under Linux/MacOSX). If noone has any objection (robot developers with a C-only compiler ?), I'll apply this everywhere soon (once again : except for the robots). -- -- Ticket URL: <http://sourceforge.net/apps/trac/speed-dreams/ticket/134#comment:1> Speed Dreams <http://sourceforge.net/projects/speed-dreams> An Open Motorsport Simulator forked from Torcs in order to deliver a better user experience through nicer and more consistent car sets, visually improved tracks and enhanced physics realism. |