aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue803/main-win.c
blob: 0cb560b3d9c2e6b46d446914735fce08a3231fc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;

}