summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-12-07 10:35:40 +0000
committerSimon Marlow <marlowsd@gmail.com>2012-12-07 10:50:42 +0000
commit250f02687eb6dc56394f1c6e9c4cc0aa5555a34b (patch)
tree5cf9cd7bf3af56499021c1be874b34fe3da09de9 /docs
parente4feb52d88d7c1ba44f3ebbdc94d7c909b81ac71 (diff)
downloadhaskell-250f02687eb6dc56394f1c6e9c4cc0aa5555a34b.tar.gz
fix code in library initialisation example (#7471)
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/ffi-chap.xml28
1 files changed, 16 insertions, 12 deletions
diff --git a/docs/users_guide/ffi-chap.xml b/docs/users_guide/ffi-chap.xml
index e778c034d0..a2fe177612 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 &lt;stdlib.h&gt;
+#include "HsFFI.h"
+
+HsBool mylib_init(void){
+ int argc = 2;
+ char *argv[] = { "+RTS", "-A32m", NULL };
+ char **pargv = argv;
- // Initialize Haskell runtime
- hs_init(&amp;argc, &amp;argv);
+ // Initialize Haskell runtime
+ hs_init(&amp;argc, &amp;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