Index: src/m3core.h =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/m3core.h,v retrieving revision 1.42 diff -u -r1.42 m3core.h --- src/m3core.h 9 May 2010 12:35:36 -0000 1.42 +++ src/m3core.h 20 May 2010 14:48:21 -0000 @@ -2,6 +2,28 @@ #pragma once #endif +/* http://gcc.gnu.org/wiki/Visibility */ +/* Generic helper definitions for shared library support */ +#if defined _WIN32 || defined __CYGWIN__ + #define M3_DLL_IMPORT __declspec(dllimport) + #define M3_DLL_EXPORT __declspec(dllexport) + #define M3_DLL_LOCAL +#else + #if __GNUC__ >= 4 + #define M3_DLL_IMPORT __attribute__ ((visibility("default"))) + #ifdef __APPLE__ + #define M3_DLL_EXPORT __attribute__ ((visibility("default"))) + #else + #define M3_DLL_EXPORT __attribute__ ((visibility("protected"))) + #endif + #define M3_DLL_LOCAL __attribute__ ((visibility("hidden"))) + #else + #define M3_DLL_IMPORT + #define M3_DLL_EXPORT + #define M3_DLL_LOCAL + #endif +#endif + #ifndef INCLUDED_M3CORE_H #define INCLUDED_M3CORE_H @@ -101,9 +123,9 @@ #define M3WRAPNAMEx(a, b) a##__##b #define M3WRAPNAME(a, b) M3WRAPNAMEx(a, b) -#define M3WRAP(ret, name, in, out) M3EXTERNC_BEGIN ret __cdecl M3WRAPNAME(M3MODULE, name) in { return name out; } M3EXTERNC_END +#define M3WRAP(ret, name, in, out) M3EXTERNC_BEGIN M3_DLL_EXPORT ret __cdecl M3WRAPNAME(M3MODULE, name) in { return name out; } M3EXTERNC_END #ifdef _WIN32 -#define M3WRAP_(ret, name, in, out) M3EXTERNC_BEGIN ret __cdecl M3WRAPNAME(M3MODULE, name) in { return _##name out; } M3EXTERNC_END +#define M3WRAP_(ret, name, in, out) M3EXTERNC_BEGIN M3_DLL_EXPORT ret __cdecl M3WRAPNAME(M3MODULE, name) in { return _##name out; } M3EXTERNC_END #else #define M3WRAP_(ret, name, in, out) M3WRAP(ret, name, in, out) #endif Index: src/Csupport/Common/dtoa.h =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/Csupport/Common/dtoa.h,v retrieving revision 1.12 diff -u -r1.12 dtoa.h --- src/Csupport/Common/dtoa.h 25 Apr 2010 23:13:31 -0000 1.12 +++ src/Csupport/Common/dtoa.h 20 May 2010 14:48:21 -0000 @@ -279,6 +279,14 @@ #include #endif +#if __GNUC__ >= 4 +#ifdef __APPLE__ +#pragma GCC visibility push(default) +#else +#pragma GCC visibility push(protected) +#endif +#endif + #ifdef __cplusplus extern "C" { #endif Index: src/Csupport/Common/hand.c =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/Csupport/Common/hand.c,v retrieving revision 1.122 diff -u -r1.122 hand.c --- src/Csupport/Common/hand.c 12 Apr 2010 14:30:42 -0000 1.122 +++ src/Csupport/Common/hand.c 20 May 2010 14:48:21 -0000 @@ -23,6 +23,14 @@ #include +#if __GNUC__ >= 4 +#ifdef __APPLE__ +#pragma GCC visibility push(default) +#else +#pragma GCC visibility push(protected) +#endif +#endif + #ifdef __cplusplus extern "C" { Index: src/thread/PTHREAD/ThreadApple.c =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/thread/PTHREAD/ThreadApple.c,v retrieving revision 1.8 diff -u -r1.8 ThreadApple.c --- src/thread/PTHREAD/ThreadApple.c 5 Mar 2010 12:54:44 -0000 1.8 +++ src/thread/PTHREAD/ThreadApple.c 20 May 2010 14:48:21 -0000 @@ -4,6 +4,10 @@ #ifndef __APPLE__ +#if __GNUC__ >= 4 +#pragma GCC visibility push(hidden) +#endif + /* avoid empty file */ void ThreadApple__Dummy(void) @@ -32,6 +36,10 @@ #include #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(hidden) +#endif + #ifdef __cplusplus extern "C" { #endif Index: src/thread/PTHREAD/ThreadFreeBSD.c =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/thread/PTHREAD/ThreadFreeBSD.c,v retrieving revision 1.8 diff -u -r1.8 ThreadFreeBSD.c --- src/thread/PTHREAD/ThreadFreeBSD.c 25 Feb 2010 08:31:33 -0000 1.8 +++ src/thread/PTHREAD/ThreadFreeBSD.c 20 May 2010 14:48:21 -0000 @@ -4,6 +4,10 @@ #ifndef __FreeBSD__ +#if __GNUC__ >= 4 +#pragma GCC visibility push(hidden) +#endif + /* avoid empty file */ void ThreadFreeBSD__Dummy(void) @@ -17,6 +21,10 @@ #include #include +#if __GNUC__ >= 4 +#pragma GCC visibility push(hidden) +#endif + #ifdef __cplusplus extern "C" { #endif Index: src/thread/PTHREAD/ThreadPThreadC.c =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/thread/PTHREAD/ThreadPThreadC.c,v retrieving revision 1.134 diff -u -r1.134 ThreadPThreadC.c --- src/thread/PTHREAD/ThreadPThreadC.c 9 May 2010 09:21:29 -0000 1.134 +++ src/thread/PTHREAD/ThreadPThreadC.c 20 May 2010 14:48:21 -0000 @@ -24,6 +24,10 @@ #include #endif +#if __GNUC__ >= 4 +#pragma GCC visibility push(hidden) +#endif + #define M3MODULE ThreadPThread #if defined(__sparc) || defined(__ia64__) Index: src/unix/Common/Uconstants.c =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/unix/Common/Uconstants.c,v retrieving revision 1.46 diff -u -r1.46 Uconstants.c --- src/unix/Common/Uconstants.c 12 Apr 2010 12:15:31 -0000 1.46 +++ src/unix/Common/Uconstants.c 20 May 2010 14:48:21 -0000 @@ -34,6 +34,14 @@ /* check that Uerror.Max=248 is enough; if you get an error here, raise it in Uerror.i3 and here */ typedef int CheckMax[248 - sizeof(CheckMax_t)]; +#if __GNUC__ >= 4 +#ifdef __APPLE__ +#pragma GCC visibility push(default) +#else +#pragma GCC visibility push(protected) +#endif +#endif + #undef X #define X(x) const int Uerror__##x = x; #include "UerrorX.h" Index: src/unix/Common/UnixC.c =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/unix/Common/UnixC.c,v retrieving revision 1.59 diff -u -r1.59 UnixC.c --- src/unix/Common/UnixC.c 9 May 2010 09:28:18 -0000 1.59 +++ src/unix/Common/UnixC.c 20 May 2010 14:48:21 -0000 @@ -48,7 +48,7 @@ { #endif -void __cdecl Unix__Assertions(void) +M3_DLL_LOCAL void __cdecl Unix__Assertions(void) { /* make sure things are normal */ M3_STATIC_ASSERT(CHAR_BIT == 8); Index: src/unix/Common/UnixLink.c =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/unix/Common/UnixLink.c,v retrieving revision 1.10 diff -u -r1.10 UnixLink.c --- src/unix/Common/UnixLink.c 16 Jan 2010 20:26:32 -0000 1.10 +++ src/unix/Common/UnixLink.c 20 May 2010 14:48:21 -0000 @@ -14,6 +14,14 @@ #include #endif +#if __GNUC__ >= 4 +#ifdef __APPLE__ +#pragma GCC visibility push(default) +#else +#pragma GCC visibility push(protected) +#endif +#endif + #ifdef __cplusplus extern "C" { Index: src/unix/Common/UstatC.c =================================================================== RCS file: /usr/cvs/cm3/m3-libs/m3core/src/unix/Common/UstatC.c,v retrieving revision 1.27 diff -u -r1.27 UstatC.c --- src/unix/Common/UstatC.c 1 May 2010 07:20:52 -0000 1.27 +++ src/unix/Common/UstatC.c 20 May 2010 14:48:21 -0000 @@ -1,5 +1,13 @@ #include "m3core.h" +#if __GNUC__ >= 4 +#ifdef __APPLE__ +#pragma GCC visibility push(default) +#else +#pragma GCC visibility push(protected) +#endif +#endif + #ifdef __cplusplus extern "C" { #endif