Using ghc-mod with FFI

In my code I have this line: foreign import ccall "set_num_states" setNumStates :: Int -> IO () I can build my project using cabal and have an appropriate "c-sources:" line. But when I use ghc-mod check (eg. from " ghc-mod-5.2.0.0", and launched from Syntastic) it complains: "ghc-mod: ByteCodeLink: can't find label During interactive linking, GHCi couldn't find the following symbol: set_num_states" How should I be checking my code? -- Dan

On 2014-11-28 05:11 PM, Dan Piponi wrote:
In my code I have this line:
foreign import ccall "set_num_states" setNumStates :: Int -> IO ()
I can build my project using cabal and have an appropriate "c-sources:" line.
But when I use ghc-mod check (eg. from " ghc-mod-5.2.0.0", and launched from Syntastic) it complains:
"ghc-mod: ByteCodeLink: can't find label During interactive linking, GHCi couldn't find the following symbol: set_num_states"
How should I be checking my code?
I don't know about ghc-mod. But I know ghci, and you may be able to lift ghci things to ghc-mod things. "ghci M.hs" or "ghci" and then ":load M.hs" gives the same error. However, you're expected to: (if your C file is s.c) "ghci s.o M.hs" or "ghci M.hs s.o" or "ghci s.o" and then ":load M.hs" that's how ghci knows where to find set_num_states. See also GHC user's guide section 2.6.2.
participants (2)
-
Albert Y. C. Lai
-
Dan Piponi