[Haskell-cafe] LLVM, getElementPtr?
lally.singh at gmail.com
Sun Dec 5 19:15:45 CET 2010
Hey all, I'm trying to get started generating LLVM code, but I'm
getting a rather cryptic error.
I wanted to create a function that takes a string and generates a
function calling to "puts" with that string as an argument:
buildReaderFun :: String -> CodeGenModule (Function (IO ()))
buildReaderFun nm = do
puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr
Word8 -> IO Word32)
greetz <- createStringNul nm
func <- createFunction ExternalLinkage $ do
tmp <- getElementPtr0 greetz (0 :: Word32, ())
call puts tmp -- Throw away return value.
(based off of some code at this blog post:
But, I get this error:
Ambiguous type variable `n' in the constraint:
arising from a use of `getElementPtr0'
Probable fix: add a type signature that fixes these type variable(s)
My attempts at figuring out what type-level has to do with this, and
how to satisfy it have so far proven unsuccessful.
Can anyone shed a little light on what's going on? Or pointers to
some documentation on any of this?
More information about the Haskell-Cafe