Dll's freeze with -threaded
Attached are two source files (one .c, one .hs), which are compiled (using mk.sh) into DsoHsDemo.dll. When this library is loaded, using the following C snippet:
int main(int argc, char* argv[])
{
printf("Started LoadLibrary\n");
LoadLibrary("DsoHsDemo.dll");
printf("Finished LoadLibrary\n");
}
The program freezes:
$ ./mk.sh && ./CSnippet
The Glorious Glasgow Haskell Compilation System, version 6.12.0.20091010
Creating library file: DsoHsDemo.dll.a
Started LoadLibrary
pre hs_init
<program freezes>
The freeze only occurs when the dll is linked with -threaded, and happens within either startupHaskell, or (if you call hs_init/hs_add_root instead) within hs_add_root. This happens with GHC 6.10.4 and 6.12rc1 on Windows XP.
This bug appears to make it impossible to successfully build a DLL for multithreaded use.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.12.1 RC1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | ndmitchell@gmail.com |
| Operating system | |
| Architecture |