aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue803/main-mac.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/gna/issue803/main-mac.c')
-rw-r--r--testsuite/gna/issue803/main-mac.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/gna/issue803/main-mac.c b/testsuite/gna/issue803/main-mac.c
new file mode 100644
index 000000000..665c347e0
--- /dev/null
+++ b/testsuite/gna/issue803/main-mac.c
@@ -0,0 +1,27 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char** argv) {
+
+ void* h = dlopen("./tb.dylib", RTLD_LAZY);
+ if (!h){
+ fprintf(stderr, "%s\n", dlerror());
+ exit(1);
+ }
+
+ typedef int main_t(int, char**);
+
+ main_t* ghdl_main = (main_t*)dlsym(h, "ghdl_main");
+ if (!ghdl_main){
+ fprintf(stderr, "%s\n", dlerror());
+ exit(2);
+ }
+
+ printf("ghdl_main return: %d\n", ghdl_main(argc, argv));
+
+ dlclose(h);
+
+ return 0;
+
+}