I'm currently modifying binary to work with MicroHs (see haskell/binary#237). However, when compiling the following example program
import Control.Applicative
import Data.Binary
import Data.Word
data Exp = IntE Int | OpE String Exp Exp deriving (Show)
instance Binary Exp where
put (IntE i) = do
put (0 :: Word8)
put i
put (OpE s e1 e2) = do
put (1 :: Word8)
put s
put e1
put e2
get = do
t <- get :: Get Word8
case t of
0 -> fmap IntE get
1 -> liftA3 OpE get get get
main :: IO ()
main = do
let bs = encode $ OpE "*" (IntE 7) (OpE "/" (IntE 4) (IntE 2))
print bs
print (decode bs :: Exp)
I get a linker error:
/usr/bin/ld: /tmp/ccnVdbAP.o: in function `xhs_free_stable_ptr':
mhsc254JJv.c:(.text+0x30): multiple definition of `xhs_free_stable_ptr'; /tmp/ccnW2rkp.o:unaligned_read.c:(.text+0x0): first defined here
/usr/bin/ld: /tmp/ccnVdbAP.o: in function `hs_free_fun_ptr':
mhsc254JJv.c:(.text+0x40): multiple definition of `hs_free_fun_ptr'; /tmp/ccnW2rkp.o:unaligned_read.c:(.text+0x10): first defined here
xhs_free_stable_ptr and hs_free_fun_ptr are defined in HsFFI.h, which has a #pragma once, so it shouldn't be included more than once.
I'm currently modifying
binaryto work with MicroHs (see haskell/binary#237). However, when compiling the following example programI get a linker error:
xhs_free_stable_ptrandhs_free_fun_ptrare defined inHsFFI.h, which has a#pragma once, so it shouldn't be included more than once.