[GHC] #10885: Crashes on FFI calls to Visual Studio-built C library

GHC ghc-devs at haskell.org
Tue Sep 15 15:09:25 UTC 2015


#10885: Crashes on FFI calls to Visual Studio-built C library
-------------------------------------+-------------------------------------
        Reporter:  mwu               |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  high              |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Windows           |            Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  Runtime crash     |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by mwu):

 @rwbarton

 From what I see {{{OSMinGW32}}} is just an OS name (meaning simply
 "Windows") and has no relation to the 32/64-bit targeting (i.e. targeted
 architecture).

 The shadow space you mention is interesting. I know little about GHC inner
 workings and calling conventions, so take my speculations with a grain of
 salt. Still, from what I understand, both MinGW and MSVC on x64 Windows
 use the same calling convention. If it was the problem, it should fail
 with both.

 Moreover, Haskell code is able to correctly call x64 MSVC-built dll. The
 problem seems to be related only to the MSVC-generated import library (the
 {{{.lib}}} file).
 You might want to compare MinGW's and MSVC's {{{adder.lib}}} files in the
 {{{repro_bin.7z}}} package I uploaded. With one, calling {{{addd}}} method
 works, with another one it crashes. I'd suspect that difference should be
 somewhere there.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10885#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list