From: <man...@us...> - 2013-05-19 12:29:15
|
Revision: 2118 http://sourceforge.net/p/modplug/code/2118 Author: manxorist Date: 2013-05-19 12:29:06 +0000 (Sun, 19 May 2013) Log Message: ----------- [Ref] First steps towards building a shared library of libopenmpt on linux. Modified Paths: -------------- trunk/OpenMPT/libopenmpt/libopenmpt_config.h trunk/OpenMPT/libopenmpt/libopenmpt_internal.h trunk/OpenMPT/openmpt123/Makefile Modified: trunk/OpenMPT/libopenmpt/libopenmpt_config.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_config.h 2013-05-19 12:27:11 UTC (rev 2117) +++ trunk/OpenMPT/libopenmpt/libopenmpt_config.h 2013-05-19 12:29:06 UTC (rev 2118) @@ -10,15 +10,40 @@ #ifndef LIBOPENMPT_CONFIG_H #define LIBOPENMPT_CONFIG_H -#if defined(LIBOPENMPT_USE_DLL) -#define LIBOPENMPT_API __declspec(dllimport) +#if defined(LIBOPENMPT_BUILD_DLL) || defined(LIBOPENMPT_USE_DLL) +#if defined(_MSC_VER) || defined(_WIN32) +#define LIBOPENMPT_DLL_HELPER_EXPORT __declspec(dllexport) +#define LIBOPENMPT_DLL_HELPER_IMPORT __declspec(dllimport) +#define LIBOPENMPT_DLL_HELPER_LOCAL +#elif defined(__GNUC__) +#define LIBOPENMPT_DLL_HELPER_EXPORT __attribute__((visibility("default"))) +#define LIBOPENMPT_DLL_HELPER_IMPORT __attribute__((visibility("default"))) +#define LIBOPENMPT_DLL_HELPER_LOCAL __attribute__((visibility("hidden"))) +#else +#define LIBOPENMPT_DLL_HELPER_EXPORT +#define LIBOPENMPT_DLL_HELPER_IMPORT +#define LIBOPENMPT_DLL_HELPER_LOCAL +#endif +#else +#define LIBOPENMPT_DLL_HELPER_EXPORT +#define LIBOPENMPT_DLL_HELPER_IMPORT +#define LIBOPENMPT_DLL_HELPER_LOCAL +#endif + +#if defined(LIBOPENMPT_BUILD_DLL) +#define LIBOPENMPT_API LIBOPENMPT_DLL_HELPER_EXPORT #ifdef __cplusplus -#define LIBOPENMPT_CXX_API __declspec(dllimport) +#define LIBOPENMPT_CXX_API LIBOPENMPT_DLL_HELPER_EXPORT #endif +#elif defined(LIBOPENMPT_USE_DLL) +#define LIBOPENMPT_API LIBOPENMPT_DLL_HELPER_IMPORT +#ifdef __cplusplus +#define LIBOPENMPT_CXX_API LIBOPENMPT_DLL_HELPER_IMPORT +#endif #else #define LIBOPENMPT_API extern #ifdef __cplusplus -#define LIBOPENMPT_CXX_API +#define LIBOPENMPT_CXX_API #endif #endif @@ -27,7 +52,7 @@ #if defined(_MSC_VER) && !defined(_DLL) #error "C++ interface is disabled if libopenmpt is built as a DLL and the runtime is statically linked. This is not supported by microsoft and cannot possibly work. Ever." #undef LIBOPENMPT_CXX_API -#define LIBOPENMPT_CXX_API +#define LIBOPENMPT_CXX_API LIBOPENMPT_DLL_HELPER_LOCAL #endif #endif #endif Modified: trunk/OpenMPT/libopenmpt/libopenmpt_internal.h =================================================================== --- trunk/OpenMPT/libopenmpt/libopenmpt_internal.h 2013-05-19 12:27:11 UTC (rev 2117) +++ trunk/OpenMPT/libopenmpt/libopenmpt_internal.h 2013-05-19 12:29:06 UTC (rev 2118) @@ -10,34 +10,19 @@ #ifndef LIBOPENMPT_INTERNAL_H #define LIBOPENMPT_INTERNAL_H -/* prevent regular config header from applying settings */ -#define LIBOPENMPT_CONFIG_H +/* disable alpha version warning in internal builds */ +#define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING -#if defined(LIBOPENMPT_BUILD_DLL) -#define LIBOPENMPT_API __declspec(dllexport) -#ifdef __cplusplus -#define LIBOPENMPT_CXX_API __declspec(dllexport) -#endif -#elif defined(LIBOPENMPT_USE_DLL) -#define LIBOPENMPT_API __declspec(dllimport) -#ifdef __cplusplus -#define LIBOPENMPT_CXX_API __declspec(dllimport) -#endif -#else -#define LIBOPENMPT_API extern -#ifdef __cplusplus -#define LIBOPENMPT_CXX_API -#endif -#endif +#include "libopenmpt_config.h" #if defined(NO_LIBOPENMPT_C) #undef LIBOPENMPT_API -#define LIBOPENMPT_API +#define LIBOPENMPT_API LIBOPENMPT_DLL_HELPER_LOCAL #endif #if defined(NO_LIBOPENMPT_CXX) #undef LIBOPENMPT_CXX_API -#define LIBOPENMPT_CXX_API +#define LIBOPENMPT_CXX_API LIBOPENMPT_DLL_HELPER_LOCAL #endif #ifdef __cplusplus @@ -48,16 +33,11 @@ #pragma message( "libopenmpt C++ interface is disabled if libopenmpt is built as a DLL and the runtime is statically linked. This is not supported by microsoft and cannot possibly work. Ever." ) #endif #undef LIBOPENMPT_CXX_API -#define LIBOPENMPT_CXX_API +#define LIBOPENMPT_CXX_API LIBOPENMPT_DLL_HELPER_LOCAL #endif #endif #endif -/* disable alpha version warning in internal builds */ -#define LIBOPENMPT_ALPHA_WARNING_SEEN_AND_I_KNOW_WHAT_I_AM_DOING - -#include "libopenmpt_version.h" - #ifdef __cplusplus namespace openmpt { namespace version { #ifndef NO_WINAMP Modified: trunk/OpenMPT/openmpt123/Makefile =================================================================== --- trunk/OpenMPT/openmpt123/Makefile 2013-05-19 12:27:11 UTC (rev 2117) +++ trunk/OpenMPT/openmpt123/Makefile 2013-05-19 12:29:06 UTC (rev 2118) @@ -4,8 +4,8 @@ LD = $(SILENT)g++ CPPFLAGS = -I../common -I.. -CXXFLAGS = -std=gnu++0x -O3 -fno-strict-aliasing -ffast-math -Wall -Wextra -CFLAGS = -std=gnu99 -O3 -fno-strict-aliasing -ffast-math -Wall -Wextra +CXXFLAGS = -std=gnu++0x -O3 -fPIC -fvisibility=hidden -fno-strict-aliasing -ffast-math -Wall -Wextra -Wcast-align +CFLAGS = -std=gnu99 -O3 -fPIC -fvisibility=hidden -fno-strict-aliasing -ffast-math -Wall -Wextra -Wcast-align LDFLAGS = LDLIBS = -lm This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |