resumeThread cannot find the thread! (GHC/HDirect)

KAKIHARA Norihiro [email protected]
Sat, 9 Jun 2001 03:11:42 +0900

I have tried to use FFI on Windows with GHC/HDirect,
but the compiled program won't have run:

  incr.exe: fatal error: resumeThread: thread not found

This is my sources and traces.  I don't know why such an
error has occured (thread, why?).  How I force this
program to find the thread?

(I have made sure `Hello' program can have been
 compiled normally...)

-- SOURCES -------------------------------------
BOOL WINAPI DllMain(args...) { return TRUE; }
int __declspec(dllexport) incr(int x) { return x + 1; }

module Incr { [pure]int incr([in]int); }

module Main(main) where
main = print (incr 2)

-- TRACES ---------------------------------------
gcc -mno-cygwin -shared -o incr.dll incr.c -Wl,--out-implib,incr.a

ihc incr.idl
ghc -fglasgow-exts -package lang -c incr.hs
# manually replace `incr@4' into `incr@\NUL\NUL'...
# (probably it should be done with .def file :o)
ghc -fglasgow-exts -c main.hs
ghc -fglasgow-exts -i. -o incr.exe incr.o main.o incr.a

-- ENVIRONMENT -----------------------------------
  OS              : Windows 98
  GHC Version     : 4.08.2 (Windows InstallShield)
                      with sh.exe in ash-200010425
  HDirect Version : 0.60 (Windows InstallShield)