aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue803/main.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.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.c')
-rw-r--r--testsuite/gna/issue803/main.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/gna/issue803/main.c b/testsuite/gna/issue803/main.c
new file mode 100644
index 000000000..80feb6019
--- /dev/null
+++ b/testsuite/gna/issue803/main.c
@@ -0,0 +1,33 @@
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char** argv) {
+
+ void* h = dlopen("./tb.so", RTLD_LAZY);
+ if (!h){
+ fprintf(stderr, "%s\n", dlerror());
+ exit(1);
+ }
+
+ typedef int main_t(int, char**);
+
+ h = dlopen("./tb.so", RTLD_LAZY);
+ if (!h){
+ fprintf(stderr, "%s\n", dlerror());
+ exit(1);
+ }
+
+ 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;
+
+}