Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/250f02687eb6dc56394f1c6e9c4cc0aa5555a34b >--------------------------------------------------------------- commit 250f02687eb6dc56394f1c6e9c4cc0aa5555a34b Author: Simon Marlow <marlo...@gmail.com> Date: Fri Dec 7 10:35:40 2012 +0000 fix code in library initialisation example (#7471) >--------------------------------------------------------------- docs/users_guide/ffi-chap.xml | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/users_guide/ffi-chap.xml b/docs/users_guide/ffi-chap.xml index e778c03..a2fe177 100644 --- a/docs/users_guide/ffi-chap.xml +++ b/docs/users_guide/ffi-chap.xml @@ -446,21 +446,25 @@ typedef enum { implemented in C or C++. For example:</para> <programlisting> - HsBool mylib_init(void){ - int argc = ... - char *argv[] = ... +#include <stdlib.h> +#include "HsFFI.h" + +HsBool mylib_init(void){ + int argc = 2; + char *argv[] = { "+RTS", "-A32m", NULL }; + char **pargv = argv; - // Initialize Haskell runtime - hs_init(&argc, &argv); + // Initialize Haskell runtime + hs_init(&argc, &pargv); - // do any other initialization here and - // return false if there was a problem - return HS_BOOL_TRUE; - } + // do any other initialization here and + // return false if there was a problem + return HS_BOOL_TRUE; +} - void mylib_end(void){ - hs_exit(); - } +void mylib_end(void){ + hs_exit(); +} </programlisting> <para>The initialisation routine, <literal>mylib_init</literal>, calls _______________________________________________ Cvs-ghc mailing list Cvs-ghc@haskell.org http://www.haskell.org/mailman/listinfo/cvs-ghc