[Haskell-cafe] LLVM, getElementPtr?
ryani.spam at gmail.com
Mon Dec 6 17:43:15 CET 2010
On Sun, Dec 5, 2010 at 12:45 PM, Lally Singh <lally.singh at gmail.com> wrote:
> Is that how it's intended?
I think that's correct, (it at least fits the pattern for 'with'
functions in Haskell).
They're idiomatically used with syntax like this:
> buildReaderFun :: String -> CodeGenModule (Function (IO ()))
> buildReaderFun nm = do
> puts <- newNamedFunction ExternalLinkage "puts" :: TFunction (Ptr Word8 -> IO Word32)
> withStringNul nm $ \greetz -> createFunction ExternalLinkage $ do
> tmp <- getElementPtr greetz (0 :: Word32,(0 :: Word32, ()))
> call puts tmp -- Throw away return value.
> ret ()
More information about the Haskell-Cafe