summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsewardj <unknown>2000-06-23 09:41:11 +0000
committersewardj <unknown>2000-06-23 09:41:11 +0000
commite46b131dcaa9a841fc374610a13fdbde1840bee9 (patch)
tree5828355854197a68fcb6af7123da497538136829
parent415765b5ef570295649d2e3f9d8a6a8f0dc51380 (diff)
downloadhaskell-e46b131dcaa9a841fc374610a13fdbde1840bee9.tar.gz
[project @ 2000-06-23 09:41:11 by sewardj]
Changes to make DietHEP.dll usable from Visual Basic: * Export DH_LoadLibrary and DH_GetProcAddress using stdcall, not ccall. * Append all messages to a logfile, diet_hep_logfile.txt, for debugging.
-rw-r--r--ghc/includes/DietHEP.h6
-rw-r--r--ghc/interpreter/DietHEP.def4
-rw-r--r--ghc/interpreter/README.BUILDING.HUGS4
-rw-r--r--ghc/interpreter/dh_demo.c6
-rw-r--r--ghc/interpreter/hugs.c43
5 files changed, 46 insertions, 17 deletions
diff --git a/ghc/includes/DietHEP.h b/ghc/includes/DietHEP.h
index ca62de8369..28b3c05d40 100644
--- a/ghc/includes/DietHEP.h
+++ b/ghc/includes/DietHEP.h
@@ -3,8 +3,10 @@ typedef enum { dh_stdcall, dh_ccall } DH_CALLCONV;
typedef int DH_MODULE;
typedef char* DH_LPCSTR;
-extern DH_MODULE DH_LoadLibrary ( DH_LPCSTR modname );
-extern void* DH_GetProcAddress ( DH_CALLCONV cconv,
+extern __attribute__((__stdcall__))
+ DH_MODULE DH_LoadLibrary ( DH_LPCSTR modname );
+extern __attribute__((__stdcall__))
+ void* DH_GetProcAddress ( DH_CALLCONV cconv,
DH_MODULE hModule,
DH_LPCSTR lpProcName );
diff --git a/ghc/interpreter/DietHEP.def b/ghc/interpreter/DietHEP.def
index 2b5031e88d..705a32296a 100644
--- a/ghc/interpreter/DietHEP.def
+++ b/ghc/interpreter/DietHEP.def
@@ -1,3 +1,3 @@
EXPORTS
-DH_GetProcAddress
-DH_LoadLibrary
+DH_GetProcAddress@12
+DH_LoadLibrary@4
diff --git a/ghc/interpreter/README.BUILDING.HUGS b/ghc/interpreter/README.BUILDING.HUGS
index a91e333511..c4be6eabd5 100644
--- a/ghc/interpreter/README.BUILDING.HUGS
+++ b/ghc/interpreter/README.BUILDING.HUGS
@@ -15,6 +15,10 @@ SplitObjs=NO # essential
Then you need to configure like this:
+ cd ghc
+ autoconf
+ cd ..
+ autoconf
./configure --host=i386-unknown-mingw32 --enable-win32-dlls
Then
diff --git a/ghc/interpreter/dh_demo.c b/ghc/interpreter/dh_demo.c
index f9de33d357..e925b7ecc3 100644
--- a/ghc/interpreter/dh_demo.c
+++ b/ghc/interpreter/dh_demo.c
@@ -11,9 +11,11 @@ typedef int DH_MODULE;
typedef char* DH_LPCSTR;
__declspec(dllimport)
-extern DH_MODULE DH_LoadLibrary ( DH_LPCSTR modname );
+extern __stdcall
+ DH_MODULE DH_LoadLibrary ( DH_LPCSTR modname );
__declspec(dllimport)
-extern void* DH_GetProcAddress ( DH_CALLCONV cconv,
+extern __stdcall
+ void* DH_GetProcAddress ( DH_CALLCONV cconv,
DH_MODULE hModule,
DH_LPCSTR lpProcName );
diff --git a/ghc/interpreter/hugs.c b/ghc/interpreter/hugs.c
index 68fc93f4f7..508091bd87 100644
--- a/ghc/interpreter/hugs.c
+++ b/ghc/interpreter/hugs.c
@@ -9,8 +9,8 @@
* included in the distribution.
*
* $RCSfile: hugs.c,v $
- * $Revision: 1.75 $
- * $Date: 2000/05/26 10:14:33 $
+ * $Revision: 1.76 $
+ * $Date: 2000/06/23 09:41:11 $
* ------------------------------------------------------------------------*/
#include <setjmp.h>
@@ -143,6 +143,14 @@ static ConId currentModule_failed = NIL; /* Remember failed module from :r */
extern void setRtsFlags ( int );
static int diet_hep_initialised = 0;
+static FILE* dh_logfile;
+
+static
+void printf_now ( void )
+{
+ time_t now = time(NULL);
+ printf("\n=== DietHEP event at %s",ctime(&now));
+}
static
void diet_hep_initialise ( void* cstackbase )
@@ -158,6 +166,14 @@ void diet_hep_initialise ( void* cstackbase )
diet_hep_initialised = 1;
CStackBase = cstackbase;
+
+ dh_logfile = freopen("diet_hep_logfile.txt","a",stdout);
+ assert(dh_logfile);
+
+ printf_now();
+ printf("===---===---=== DietHEP initialisation ===---===---===\n\n");
+ fflush(stdout);
+
EnableOutput(1);
setInstallDir ( "diet_hep" );
@@ -170,8 +186,8 @@ void diet_hep_initialise ( void* cstackbase )
prelOK = loadThePrelude();
if (!prelOK) {
- fprintf(stderr, "diet_hep_initialise: fatal error: "
- "can't load the Prelude.\n" );
+ printf("diet_hep_initialise: fatal error: "
+ "can't load the Prelude.\n" );
exit(1);
}
@@ -229,20 +245,22 @@ void* DH_GetProcAddress_wrk ( DH_CALLCONV cconv,
}
/*----------- EXPORTS -------------*/
-__declspec(dllexport)
+ __attribute__((__stdcall__))
DH_MODULE
DH_LoadLibrary ( DH_LPCSTR modname )
{
int xxx;
DH_MODULE hdl;
diet_hep_initialise ( &xxx );
+ printf_now();
+ printf("=== DH_LoadLibrary: request to load `%s'\n\n", modname );
+ fflush(stdout);
hdl = DH_LoadLibrary_wrk ( modname );
- printf ( "hdl = %d\n", hdl );
return hdl;
}
-__declspec(dllexport)
+ __attribute__((__stdcall__))
void*
DH_GetProcAddress ( DH_CALLCONV cconv,
DH_MODULE hModule,
@@ -250,6 +268,9 @@ DH_GetProcAddress ( DH_CALLCONV cconv,
{
int xxx;
diet_hep_initialise ( &xxx );
+ printf_now();
+ printf("=== DH_GetProcAddress: request for `%s'\n\n", lpProcName );
+ fflush(stdout);
return DH_GetProcAddress_wrk ( cconv, hModule, lpProcName );
}
@@ -929,13 +950,13 @@ static void ppMG ( void )
u = hd(t);
switch (whatIs(u)) {
case GRP_NONREC:
- FPrintf ( stderr, " %s\n", textToStr(textOf(snd(u))));
+ Printf ( " %s\n", textToStr(textOf(snd(u))));
break;
case GRP_REC:
- FPrintf ( stderr, " {" );
+ Printf ( " {" );
for (v = snd(u); nonNull(v); v=tl(v))
- FPrintf ( stderr, "%s ", textToStr(textOf(hd(v))) );
- FPrintf ( stderr, "}\n" );
+ Printf ( "%s ", textToStr(textOf(hd(v))) );
+ Printf ( "}\n" );
break;
default:
internal("ppMG");