diff --git a/src/libs/tgf/module.cpp b/src/libs/tgf/module.cpp index bef82fea3..f40e4f263 100644 --- a/src/libs/tgf/module.cpp +++ b/src/libs/tgf/module.cpp @@ -26,9 +26,9 @@ #ifdef WIN32 # include -# define dlopen(soFileName) (void*)LoadLibrary(soFileName) -# define dlsym(pvoid) GetProcAddress((HMODULE)pvoid) -# define dlclose(pvoid) !FreeLibrary((HMODULE)pvoid) +# define dlopen(pszShLibFileName) (void*)LoadLibrary(pszShLibFileName) +# define dlsym(pvHandle, pszFuncName) GetProcAddress((HMODULE)pvHandle, pszFuncName) +# define dlclose(pvHandle) !FreeLibrary((HMODULE)pvHandle) # define soLibHandle(handle) (void*)handle #else # include @@ -38,10 +38,10 @@ // Name and type of the 2 extern "C" module interface functions. typedef int (*tModOpenFunc)(const char*, void*); // Returns 0 on success, !0 otherwise. -static const char* pszOpenModuleFuncName = "GfModuleOpen"; +static const char* pszOpenModuleFuncName = "openGfModule"; typedef int (*tModCloseFunc)(); // Returns 0 on success, !0 otherwise. -static const char* pszCloseModuleFuncName = "GfModuleClose"; +static const char* pszCloseModuleFuncName = "closeGfModule"; // Error code decoder. static std::string lastDLErrorString() @@ -109,7 +109,7 @@ GfModule* GfModule::load(const std::string& strShLibName) { GfLogError("Library %s doesn't export any '%s' function' ; module NOT loaded\n", strShLibName.c_str(), pszOpenModuleFuncName); - dlclose(hSOLib); + (void)dlclose(hSOLib); return 0; } @@ -118,7 +118,7 @@ GfModule* GfModule::load(const std::string& strShLibName) { GfLogError("Library %s '%s' function call failed ; module NOT loaded\n", strShLibName.c_str(), pszOpenModuleFuncName); - dlclose(hSOLib); + (void)dlclose(hSOLib); return 0; } @@ -127,7 +127,7 @@ GfModule* GfModule::load(const std::string& strShLibName) { GfLogError("Library %s '%s' function failed to register the open module ; NOT loaded\n", strShLibName.c_str(), pszOpenModuleFuncName); - dlclose(hSOLib); + (void)dlclose(hSOLib); return 0; } diff --git a/src/libs/tgf/tgf.hpp b/src/libs/tgf/tgf.hpp index d909fbaed..27cdc445e 100644 --- a/src/libs/tgf/tgf.hpp +++ b/src/libs/tgf/tgf.hpp @@ -24,6 +24,11 @@ #ifndef __TGF__HPP__ #define __TGF__HPP__ +#ifdef _MSC_VER +// Disable useless MSVC warnings +# pragma warning (disable:4251) // class XXX needs a DLL interface ... +#endif + #include #include diff --git a/src/modules/userinterface/legacymenu/CMakeLists.txt b/src/modules/userinterface/legacymenu/CMakeLists.txt index 694c2a84d..ae93d5494 100644 --- a/src/modules/userinterface/legacymenu/CMakeLists.txt +++ b/src/modules/userinterface/legacymenu/CMakeLists.txt @@ -49,9 +49,6 @@ ADD_SDL_INCLUDEDIR() ADD_ENET_INCLUDEDIR() IF(WIN32) - # DLL export stuff under Windows (to avoid .def file) - ADD_DEFINITIONS(-DLEGACYMENU_DLL) - # Ignore some run-time libs to avoid link time warnings and sometimes even crashes. SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:msvcrt.lib") ENDIF(WIN32) diff --git a/src/modules/userinterface/legacymenu/legacymenu.cpp b/src/modules/userinterface/legacymenu/legacymenu.cpp index 4036aea62..4cf8d8134 100644 --- a/src/modules/userinterface/legacymenu/legacymenu.cpp +++ b/src/modules/userinterface/legacymenu/legacymenu.cpp @@ -28,7 +28,7 @@ // The LegacyMenu singleton. LegacyMenu* LegacyMenu::_pSelf = 0; -int GfModuleOpen(const char* pszShLibName, void* hShLibHandle) +int openGfModule(const char* pszShLibName, void* hShLibHandle) { // Instanciate the (only) module instance. LegacyMenu::_pSelf = new LegacyMenu(pszShLibName, hShLibHandle); @@ -41,7 +41,7 @@ int GfModuleOpen(const char* pszShLibName, void* hShLibHandle) return LegacyMenu::_pSelf ? 0 : 1; } -int GfModuleClose() +int closeGfModule() { // Delete the (only) module instance. delete LegacyMenu::_pSelf; @@ -53,7 +53,7 @@ int GfModuleClose() LegacyMenu& LegacyMenu::self() { - // Pre-condition : 1 successfull GfModuleOpen call. + // Pre-condition : 1 successfull openGfModule call. return *_pSelf; } diff --git a/src/modules/userinterface/legacymenu/legacymenu.h b/src/modules/userinterface/legacymenu/legacymenu.h index 92a077e36..a509f4c74 100644 --- a/src/modules/userinterface/legacymenu/legacymenu.h +++ b/src/modules/userinterface/legacymenu/legacymenu.h @@ -31,7 +31,7 @@ // DLL exported symbols declarator for Windows. #ifdef WIN32 -# ifdef LEGACYMENU_DLL +# ifdef legacymenu_EXPORTS # define LEGACYMENU_API __declspec(dllexport) # else # define LEGACYMENU_API __declspec(dllimport) @@ -42,8 +42,8 @@ // The C interface of the module. -LEGACYMENU_API extern "C" int GfModuleOpen(const char* pszShLibName, void* hShLibHandle); -LEGACYMENU_API extern "C" int GfModuleClose(); +extern "C" int LEGACYMENU_API openGfModule(const char* pszShLibName, void* hShLibHandle); +extern "C" int LEGACYMENU_API closeGfModule(); // The module main class (inherits GfModule, and implements IUserInterface). class LEGACYMENU_API LegacyMenu : public GfModule, public IUserInterface @@ -112,8 +112,8 @@ protected: IRaceEngine* _piRaceEngine; // Make the C interface functions nearly member functions. - friend LEGACYMENU_API int GfModuleOpen(const char* pszShLibName, void* hShLibHandle); - friend LEGACYMENU_API int GfModuleClose(); + friend int openGfModule(const char* pszShLibName, void* hShLibHandle); + friend int closeGfModule(); }; #endif /* _LEGACYMENU_H_ */