aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue803/main-win.c
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/gna/issue803/main-win.c')
-rw-r--r--testsuite/gna/issue803/main-win.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/testsuite/gna/issue803/main-win.c b/testsuite/gna/issue803/main-win.c
new file mode 100644
index 000000000..0cb560b3d
--- /dev/null
+++ b/testsuite/gna/issue803/main-win.c
@@ -0,0 +1,27 @@
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char** argv) {
+
+ void* h = LoadLibraryA(".\\tb.dll");
+ if (!h){
+ fprintf(stderr, "error: cannot load library\n");
+ exit(1);
+ }
+
+ typedef int main_t(int, char**);
+
+ main_t* ghdl_main = (main_t*)GetProcAddress(h, "_ghdl_main");
+ if (!ghdl_main){
+ fprintf(stderr, "error: cannot find symbol\n");
+ exit(2);
+ }
+
+ printf("ghdl_main return: %d\n", ghdl_main(argc, argv));
+
+ FreeLibrary(h);
+
+ return 0;
+
+}