[GHC] #11531: ghci with ffi to inline assembly results in "the 'impossible'"
GHC
ghc-devs at haskell.org
Wed Feb 3 05:53:02 UTC 2016
#11531: ghci with ffi to inline assembly results in "the 'impossible'"
---------------------------------+--------------------------------------
Reporter: isovector | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.4
Resolution: duplicate | Keywords: ffi, asm, ghci
Operating System: Linux | Architecture: x86_64 (amd64)
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #10458 | Differential Rev(s):
Wiki Page: |
---------------------------------+--------------------------------------
Changes (by rwbarton):
* status: new => closed
* resolution: => duplicate
* related: => #10458
Comment:
Thanks for the report.
Actually, the issue here is that you wrote a C++ program. In order to link
C++-compiled object files with the outside world, you need to link with
the C++ standard library, `-lstdc++`. So, you could do this:
{{{
$ ghci ffi.o Main.hs -lstdc++
}}}
This won't actually work in 7.8 or 7.10, because of #10458. But I tested
that it does work in current HEAD and 8.0. So, closing as a duplicate of
that ticket.
In the meantime, you can build your C++ object into a shared library
yourself, and load that in ghci:
{{{
$ g++ -shared -o libmyffi.so ffi.o
$ ghci Main.hs -L. -lmyffi
}}}
Alternatively, just write your inline assembly in C.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11531#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list