From e012fd2606c75a61c620a9d0cb26b35369824a97 Mon Sep 17 00:00:00 2001 From: Daniel Wallin Date: Sat, 20 Dec 2008 20:25:48 +0100 Subject: [PATCH] Always use __declspec(dllimport/dllexport) on Windows. When building on MinGW we didn't use dllexport/dllimport, which meant the dll-builds didn't work properly. --- Jamroot | 5 ++--- luabind/config.hpp | 38 ++++++++++++++------------------------ 2 files changed, 16 insertions(+), 27 deletions(-) diff --git a/Jamroot b/Jamroot index 5f52ccf..614feda 100755 --- a/Jamroot +++ b/Jamroot @@ -133,9 +133,8 @@ SOURCES = usage-requirements = lua - msvc,shared:LUABIND_IMPORT=__declspec(dllimport) - msvc,shared:LUABIND_EXPORT=__declspec(dllexport) - msvc,shared:/wd4251 ; + msvc,shared:/wd4251 + shared:LUABIND_DYNAMIC_LINK ; lib luabind : src/$(SOURCES) diff --git a/luabind/config.hpp b/luabind/config.hpp index a91ac77..55db778 100644 --- a/luabind/config.hpp +++ b/luabind/config.hpp @@ -123,32 +123,22 @@ namespace std // by luabind throws an exception (throwing exceptions through // C code has undefined behavior, lua is written in C). -// LUABIND_EXPORT -// LUABIND_IMPORT -// If you're building luabind as a dll on windows with devstudio -// you can set LUABIND_EXPORT to __declspec(dllexport) -// and LUABIND_IMPORT to __declspec(dllimport) - -#if _GNUC_ >= 4 -#define LUABIND_API __attribute__ ((visibility("default"))) -#else - -// this define is set if we're currently building a luabind file -// select import or export depending on it -#ifdef LUABIND_BUILDING - #ifdef LUABIND_EXPORT - #define LUABIND_API LUABIND_EXPORT - #else - #define LUABIND_API - #endif -#else - #ifdef LUABIND_IMPORT - #define LUABIND_API LUABIND_IMPORT - #else - #define LUABIND_API - #endif +#ifdef LUABIND_DYNAMIC_LINK +# ifdef BOOST_WINDOWS +# ifdef LUABIND_BUILDING +# define LUABIND_API __declspec(dllexport) +# else +# define LUABIND_API __declspec(dllimport) +# endif +# else +# if defined(_GNUC_) && _GNUC_ >=4 +# define LUABIND_API __attribute__ ((visibility("default"))) +# endif +# endif #endif +#ifndef LUABIND_API +# define LUABIND_API #endif namespace luabind { -- 2.11.4.GIT