aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/CheckSharedFunctionExists.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-02-16 05:36:49 -0800
committerChris Robinson <[email protected]>2010-02-16 05:36:49 -0800
commit2083884ae329072b316e725330af92f683786451 (patch)
tree9e4ababb91633c6ab5e5a6b17d634cfff79be073 /cmake/CheckSharedFunctionExists.c
parent2f644c7ed5d72ec1a469be3e028923d475403f0b (diff)
Properly check for functions in Win32 shared libs
Diffstat (limited to 'cmake/CheckSharedFunctionExists.c')
-rw-r--r--cmake/CheckSharedFunctionExists.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/cmake/CheckSharedFunctionExists.c b/cmake/CheckSharedFunctionExists.c
new file mode 100644
index 00000000..31e3fa92
--- /dev/null
+++ b/cmake/CheckSharedFunctionExists.c
@@ -0,0 +1,38 @@
+#ifdef CHECK_SHARED_FUNCTION_EXISTS
+
+#include <stdlib.h>
+
+#ifndef CALLSTACK
+#define CALLSTACK
+#endif
+
+#ifdef _WIN32
+#ifdef ARGSTACK
+char __stdcall CHECK_SHARED_FUNCTION_EXISTS(ARGSTACK);
+#else
+char __stdcall CHECK_SHARED_FUNCTION_EXISTS(void);
+#endif
+#else
+char CHECK_SHARED_FUNCTION_EXISTS();
+#endif
+
+#ifdef __CLASSIC_C__
+int main(){
+ int ac;
+ char*av[];
+#else
+int main(int ac, char*av[]){
+#endif
+ CHECK_SHARED_FUNCTION_EXISTS(CALLSTACK);
+ if(ac > 1000)
+ {
+ return *av[0];
+ }
+ return 0;
+}
+
+#else /* CHECK_SHARED_FUNCTION_EXISTS */
+
+# error "CHECK_SHARED_FUNCTION_EXISTS has to specify the function"
+
+#endif /* CHECK_SHARED_FUNCTION_EXISTS */