[project @ 2001-01-17 15:11:04 by simonmar]
[ghc-hetmet.git] / ghc / interpreter / dh_demo.c
1
2
3 #include <stdio.h>
4 #include <assert.h>
5 #include <windows.h>
6 //#include "../includes/DietHEP.h"
7
8
9 typedef enum { dh_stdcall, dh_ccall } DH_CALLCONV;
10 typedef int                           DH_MODULE;
11 typedef char*                         DH_LPCSTR;
12
13 __declspec(dllimport)
14 extern __stdcall
15        DH_MODULE DH_LoadLibrary    ( DH_LPCSTR modname );
16 __declspec(dllimport)
17 extern __stdcall
18        void*     DH_GetProcAddress ( DH_CALLCONV  cconv, 
19                                      DH_MODULE    hModule, 
20                                      DH_LPCSTR    lpProcName );
21
22
23 int main ( int argc, char** argv )
24 {
25    {
26    DH_MODULE hModule;
27    void(*proc)(int);
28
29    hModule = DH_LoadLibrary("Dh_Demo");   /* note no .hs */
30    assert(hModule != 0);
31    proc = DH_GetProcAddress ( dh_ccall, hModule, "wurble" );
32    assert(proc);
33
34    proc(44);
35    proc(45);
36    proc(46);
37    }
38    return 0;
39 }