aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue803/main-mac.c
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-01-26 07:50:21 +0100
committerTristan Gingold <tgingold@free.fr>2021-01-26 07:50:21 +0100
commit7135caeea2880d7d1ee96a66bd7941bcc56a4ddb (patch)
treea544198df50588d8d4d917b76d9b9ef11928fe18 /testsuite/gna/issue803/main-mac.c
parent0978b48007afe920d8f7000c2c8722327c901259 (diff)
downloadghdl-7135caeea2880d7d1ee96a66bd7941bcc56a4ddb.tar.gz
ghdl-7135caeea2880d7d1ee96a66bd7941bcc56a4ddb.tar.bz2
ghdl-7135caeea2880d7d1ee96a66bd7941bcc56a4ddb.zip
testsuite/gna: add a test for #803
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;
+
+}