resumeThread cannot find the thread! (GHC/HDirect)

KAKIHARA Norihiro YIU04646@nifty.com
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 -------------------------------------
[incr.c]
BOOL WINAPI DllMain(args...) { return TRUE; }
int __declspec(dllexport) incr(int x) { return x + 1; }

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

[Main.hs]
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)