HaskellWiki

Haskell | Wiki community | Recent changes
Random page | Special pages

 

Not logged in
Log in | Help

Yhc/API/Interpreter

< Yhc | API

Part of Yhc

(Download)

1 Yhc - Yhi Api

Some people want an Api for Yhi. It's needed for a good version of Yhe.

In particular its needed to embed Haskell into Linda.

1.1 Load a module

//Load a module from an array of bytes
Module loadModule(const char* Data, int Length);
//Load a module from a file
Module loadModuleFromFile(const char* FileName);

1.2 Running Main

data Console = Console {
    stdout :: Char -> IO (),
    stderr :: Char -> IO (),
    stdin  :: IO Char
  }
runMain :: Module -> Console -> IO ()
runMainThread :: Module -> Console -> IO () -> IO (IO ())
-- result is an action that when applied aborts the computation.
-- There is also an IO that is evaluated when the program terminates cleanly.

Apparently GtkHs does this, uses FunPtr, grep for "foreign .*wrapper" - see FfiCookbook

Retrieved from "http://haskell.org/haskellwiki/Yhc/API/Interpreter"

This page has been accessed 1,629 times. This page was last modified 02:42, 15 January 2006. Recent content is available under a simple permissive license.