From 7135caeea2880d7d1ee96a66bd7941bcc56a4ddb Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 26 Jan 2021 07:50:21 +0100 Subject: testsuite/gna: add a test for #803 --- testsuite/gna/issue803/main-mac.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 testsuite/gna/issue803/main-mac.c (limited to 'testsuite/gna/issue803/main-mac.c') 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 +#include +#include + +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; + +} -- cgit v1.2.3