diff Isolated/SimpleThread.h @ 56:208a9ed20087

Added explicit symbol visibility markers to audio support files in ALmixer for public headers so they can be built as a dynamic library if needed.
author Eric Wing <ewing@anscamobile.com>
date Tue, 29 May 2012 19:43:23 -0700
parents 71b465ff0622
children 36644b1b940b
line wrap: on
line diff
--- a/Isolated/SimpleThread.h	Tue May 29 19:41:59 2012 -0700
+++ b/Isolated/SimpleThread.h	Tue May 29 19:43:23 2012 -0700
@@ -5,21 +5,45 @@
 extern "C" {
 #endif
 	
+	#if defined(_WIN32)
+		#if defined(SIMPLE_THREAD_BUILD_LIBRARY)
+			#define SIMPLE_THREAD_DECLSPEC __declspec(dllexport)
+		#else
+			#define SIMPLE_THREAD_DECLSPEC __declspec(dllimport)
+		#endif
+	#else
+		#if defined(SIMPLE_THREAD_BUILD_LIBRARY)
+			#if defined (__GNUC__) && __GNUC__ >= 4
+				#define SIMPLE_THREAD_DECLSPEC __attribute__((visibility("default")))
+			#else
+				#define SIMPLE_THREAD_DECLSPEC
+			#endif
+		#else
+			#define SIMPLE_THREAD_DECLSPEC
+		#endif
+	#endif
+
+	#if defined(_WIN32)
+		#define SIMPLE_THREAD_CALL __cdecl
+	#else
+		#define SIMPLE_THREAD_CALL
+	#endif
+
 #include <stddef.h>
 
 typedef struct SimpleThread SimpleThread;
 
 
-SimpleThread* SimpleThread_CreateThread(int (*user_function)(void*), void* user_data);
+extern SIMPLE_THREAD_DECLSPEC SimpleThread* SIMPLE_THREAD_CALL SimpleThread_CreateThread(int (*user_function)(void*), void* user_data);
 
-size_t SimpleThread_GetCurrentThreadID(void);
-size_t SimpleThread_GetThreadID(SimpleThread* simple_thread);
+extern SIMPLE_THREAD_DECLSPEC size_t SIMPLE_THREAD_CALL SimpleThread_GetCurrentThreadID(void);
+extern SIMPLE_THREAD_DECLSPEC size_t SIMPLE_THREAD_CALL SimpleThread_GetThreadID(SimpleThread* simple_thread);
 
-void SimpleThread_WaitThread(SimpleThread* simple_thread, int* thread_status);
+extern SIMPLE_THREAD_DECLSPEC void SIMPLE_THREAD_CALL SimpleThread_WaitThread(SimpleThread* simple_thread, int* thread_status);
 
 
-int SimpleThread_GetThreadPriority(SimpleThread* simple_thread);
-void SimpleThread_SetThreadPriority(SimpleThread* simple_thread, int priority_level);
+extern SIMPLE_THREAD_DECLSPEC int SIMPLE_THREAD_CALL SimpleThread_GetThreadPriority(SimpleThread* simple_thread);
+extern SIMPLE_THREAD_DECLSPEC void SIMPLE_THREAD_CALL SimpleThread_SetThreadPriority(SimpleThread* simple_thread, int priority_level);
 
 /* Ends C function definitions when using C++ */
 #ifdef __cplusplus