[commit: ghc] ghc-7.6: fix code in library initialisation example (#7471) (723570d)

Ian Lynagh <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : ghc-7.6

http://hackage.haskell.org/trac/ghc/changeset/723570dab0384e295ced98089703060fce52e616

>---------------------------------------------------------------

commit 723570dab0384e295ced98089703060fce52e616
Author: Simon Marlow <[email protected]>
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 &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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.