[project @ 2005-10-28 15:51:15 by simonmar]
authorsimonmar <unknown>
Fri, 28 Oct 2005 15:51:15 +0000 (15:51 +0000)
committersimonmar <unknown>
Fri, 28 Oct 2005 15:51:15 +0000 (15:51 +0000)
document -stubdir

ghc/docs/users_guide/ffi-chap.xml
ghc/docs/users_guide/flags.xml
ghc/docs/users_guide/separate_compilation.xml

index 84fb8ae..e1374c4 100644 (file)
@@ -107,6 +107,11 @@ extern HsInt foo(HsInt a0);</programlisting>
       invoke <literal>foo()</literal> from C, just <literal>#include
       "Foo_stub.h"</literal> and call <literal>foo()</literal>.</para>
 
+      <para>The <filename>foo_stub.c</filename> and
+       <filename>foo_stub.h</filename> files can be redirected using the
+       <option>-stubdir</option> option; see <xref linkend="options-output"
+         />.</para>
+
       <sect3 id="using-own-main"> 
        <title>Using your own <literal>main()</literal></title>
 
index bbd57a0..a6c4d12 100644 (file)
              <entry>dynamic</entry>
              <entry>-</entry>
            </row>
+           <row>
+             <entry><option>-stubdir</option> <replaceable>dir</replaceable></entry>
+             <entry>redirect FFi stub files</entry>
+             <entry>dynamic</entry>
+             <entry>-</entry>
+           </row>
          </tbody>
        </tgroup>
       </informaltable>
index 97fe772..fc44fe6 100644 (file)
           <filename>Main.hs</filename>, and put the resulting
           executable in <filename>foo.exe</filename> (not
           <filename>foo</filename>).</para>
+
+          <para>If you use <command>ghc --make</command> and you don't
+          use the <option>-o</option>, the name GHC will choose
+          for the executable will be based on the name of the file
+          containing the module <literal>Main</literal>. 
+          Note that with GHC the <literal>Main</literal> module doesn't
+          have to be put in file <filename>Main.hs</filename>.
+          Thus both
+<programlisting>
+   ghc --make Prog
+</programlisting>
+          and
+<programlisting>
+   ghc --make Prog.hs
+</programlisting>
+          will produce <filename>Prog</filename> (or
+          <filename>Prog.exe</filename> if you are on Windows).</para>
          </listitem>
        </varlistentry>
 
@@ -326,6 +343,23 @@ $ ghc -c parse/Foo.hs parse/Bar.hs gurgle/Bumble.hs -odir `arch`
 
        <varlistentry>
          <term>
+            <option>-stubdir</option>  <replaceable>dir</replaceable>
+            <indexterm><primary><option>-stubdir</option></primary></indexterm>
+          </term>
+         <listitem>
+           <para>Redirects all generated FFI stub files into
+           <replaceable>dir</replaceable>.  Stub files are generated when the
+           Haskell source contains a <literal>foreign export</literal> or
+           <literal>foreign import "&amp;wrapper"</literal> declaration (see <xref
+             linkend="foreign-export-ghc" />).  The <option>-stubdir</option>
+             option behaves in exactly the same way as <option>-odir</option>
+             and <option>-hidir</option> with respect to hierarchical
+           modules.</para>
+         </listitem>
+       </varlistentry>
+
+       <varlistentry>
+         <term>
             <option>-osuf</option> <replaceable>suffix</replaceable>
             <indexterm><primary><option>-osuf</option></primary></indexterm>
           </term>