[GHC] #7612: Automatically start the haskell runtime in DllMain on windows -shared

#7612: Automatically start the haskell runtime in DllMain on windows -shared
----------------------------+-----------------------------------------------
Reporter: schyler | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 7.6.1 | Keywords:
Os: Windows | Architecture: Unknown/Multiple
Failure: None/Unknown | Blockedby:
Blocking: | Related:
----------------------------+-----------------------------------------------
On Windows DllMain is called when a dll is loaded into a process via
LoadLibrary (or even when it's loaded as a regular dependency).
Currently a stub, such as this, is required to be linked with all haskell
dll compilations on windows that plan to have their functions called from
non-haskell origins;
{{{
#include

#7612: Automatically start the haskell runtime in DllMain on windows -shared ---------------------------------+------------------------------------------ Reporter: schyler | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.1 Keywords: | Os: Windows Architecture: Unknown/Multiple | Failure: None/Unknown Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by simonpj): * difficulty: => Unknown Comment: We'd LOVE anyone who knows about Windows and DLLs to improve the GHC experience on that platform. Thank you. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7612#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7612: Automatically start the haskell runtime in DllMain on windows -shared ------------------------------+--------------------------------------------- Reporter: schyler | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.1 Resolution: wontfix | Keywords: Os: Windows | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------+--------------------------------------------- Changes (by simonmar): * status: new => closed * resolution: => wontfix Comment: You're looking at a very old version of the docs, the latest is here: [http://www.haskell.org/ghc/docs/latest/html/users_guide/win32-dlls.html]. Note in particular that you cannot initialise Haskell from `DllMain()`, and the function to call is `hs_init`, not `startupHaskell`. I'm not sure if it's possible to do what you want. You can't call `hs_init` from `DllMain`, and you can't create a thread that will call it later. So I'll close this ticket, but if you think it can be done please re-open and describe how. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7612#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7612: Automatically start the haskell runtime in DllMain on windows -shared ------------------------------+--------------------------------------------- Reporter: schyler | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.1 Resolution: | Keywords: Os: Windows | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------+--------------------------------------------- Changes (by schyler): * status: closed => new * resolution: wontfix => Comment: I will do some personal investigation. This feature could be easily implemented but the hs_init routine would need to be audited such that it does not make any non-Kernel32 calls. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7612#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7612: Automatically start the haskell runtime in DllMain on windows -shared ------------------------------+--------------------------------------------- Reporter: schyler | Owner: Type: feature request | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.6.1 Resolution: | Keywords: Os: Windows | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------+--------------------------------------------- Changes (by simonmar): * status: new => infoneeded Comment: I'll move the ticket into the infoneeded state, but I think you'll find that `hs_init` touches a lot of code (including creating threads), so it's not feasible to make it safe to use from `DllMain`. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7612#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7612: Automatically start the haskell runtime in DllMain on windows -shared ------------------------------+--------------------------------------------- Reporter: schyler | Owner: Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.1 Resolution: wontfix | Keywords: Os: Windows | Architecture: Unknown/Multiple Failure: None/Unknown | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------+--------------------------------------------- Changes (by igloo): * status: infoneeded => closed * resolution: => wontfix Comment: I think it's best to just close this ticket, but of course please feel free to reopen it or file a new one if you find that this is possible after all. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7612#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC