aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/CheckSharedFunctionExists.c
diff options
context:
space:
mode:
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 */