[Haskell-cafe] Re: LLVM -> Haskell

Tom Hawkins tomahawkins at gmail.com
Mon May 31 18:02:59 EDT 2010


> For instance, the LLVM.FFI.BitReader module has some functions that'll get you a ModuleRef from some bitcode.

getBitcodeModuleInContext :: ContextRef  -> MemoryBufferRef  -> Ptr
ModuleRef  -> Ptr  CString  -> IO  Bool
type ModuleRef = Ptr  Module
data Module

I'm confused how this works.  How does one get a Ptr ModuleRef to call
this function?  Module is not Storable, so you can't use alloca or
malloc.  And I don't see any functions in the library that returns a
Ptr ModuleRef.  What am I missing?  (Sorry, I lack experience with
Foreign.Ptr.)

To get started, I want to make a function that reads an llvm object
file and returns a ModuleRef:

readObj :: FilePath -> IO ModuleRef

-Tom


More information about the Haskell-Cafe mailing list