Commit 250f0268 authored by Simon Marlow's avatar Simon Marlow
Browse files

fix code in library initialisation example (#7471)

parent e4feb52d
...@@ -446,21 +446,25 @@ typedef enum { ...@@ -446,21 +446,25 @@ typedef enum {
implemented in C or C++. For example:</para> implemented in C or C++. For example:</para>
<programlisting> <programlisting>
HsBool mylib_init(void){ #include &lt;stdlib.h&gt;
int argc = ... #include "HsFFI.h"
char *argv[] = ...
HsBool mylib_init(void){
int argc = 2;
char *argv[] = { "+RTS", "-A32m", NULL };
char **pargv = argv;
// Initialize Haskell runtime // Initialize Haskell runtime
hs_init(&amp;argc, &amp;argv); hs_init(&amp;argc, &amp;pargv);
// do any other initialization here and // do any other initialization here and
// return false if there was a problem // return false if there was a problem
return HS_BOOL_TRUE; return HS_BOOL_TRUE;
} }
void mylib_end(void){ void mylib_end(void){
hs_exit(); hs_exit();
} }
</programlisting> </programlisting>
<para>The initialisation routine, <literal>mylib_init</literal>, calls <para>The initialisation routine, <literal>mylib_init</literal>, calls
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment