I'm trying to use Haskell's LLVM bindings to create a very simple 'hello world' standalone app. The idea is, when I run my Haskell application, it will spit out some bytecode that can in turn be run and will output "hello world!"
-- hellofunc prints out "hello world"
hellofunc :: CodeGenModule (Function (IO ()))
_main :: (Function (IO ())) -> CodeGenModule (Function (IO ()))
_main func = createNamedFunction ExternalLinkage "main" $ do
call func
ret ()
main = writeCodeGenModule "hello.bc" (liftA _main hellofunc)
When I run this, I see the following error:
'main' function not found in module.
I'm explicitly creating the main
function using createNamedFunction
. What am I missing?