In Scurry, I select the CALLCONV on the CPP command line. This might be better if it&#39;s the only place you need an #ifdef.<div><br></div><div><a href="http://hackage.haskell.org/packages/archive/Scurry/0.0.3/Scurry.cabal">http://hackage.haskell.org/packages/archive/Scurry/0.0.3/Scurry.cabal</a></div>
<div><br></div><div>See the OS selection in the executable section:</div><div><span class="Apple-style-span" style="font-family: &#39;Times New Roman&#39;; font-size: 16px; "><pre style="word-wrap: break-word; white-space: pre-wrap; ">
<span class="Apple-style-span" style="font-size: small;">executable scurry</span></pre><pre style="word-wrap: break-word; white-space: pre-wrap; "><span class="Apple-style-span" style="font-size: small;">[..]</span></pre>
<pre style="word-wrap: break-word; white-space: pre-wrap; "><span class="Apple-style-span" style="font-family: &#39;Times New Roman&#39;; white-space: normal; "><pre style="word-wrap: break-word; white-space: pre-wrap; ">
<span class="Apple-style-span" style="font-size: small;">    if os(mingw32)
        c-sources:          src/C/help-win.c
        extra-libraries:    Iphlpapi, ws2_32
        cc-options:         -D MINGW32
        cpp-options:        -DCALLCONV=stdcall

    if os(linux)
        build-depends: unix &gt;= 2.3.0.0
        c-sources:          src/C/help-linux.c
        cc-options:         -D LINUX
        cpp-options:        -DCALLCONV=ccall</span></pre></span></pre></span><div><br clear="all">/jve<br>
<br><br><div class="gmail_quote">On Mon, Mar 30, 2009 at 4:41 AM, Alistair Bayley <span dir="ltr">&lt;<a href="mailto:alistair@abayley.org">alistair@abayley.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2009/3/29 Johan Tibell &lt;<a href="mailto:johan.tibell@gmail.com">johan.tibell@gmail.com</a>&gt;:<br>
<div class="im">&gt;<br>
&gt; foreign import CALLCONV unsafe &quot;send&quot;<br>
&gt;    c_send :: CInt -&gt; Ptr a -&gt; CSize -&gt; CInt -&gt; IO CInt<br>
&gt;<br>
&gt; Compiling results in:<br>
&gt;<br>
&gt; parse error on input `CALLCONV&#39;<br>
<br>
<br>
</div>This is what we use in Takusen&#39;s Database.ODBC.OdbcFunctions.hsc:<br>
<br>
#ifdef mingw32_HOST_OS<br>
#let CALLCONV = &quot;stdcall&quot;<br>
#else<br>
#let CALLCONV = &quot;ccall&quot;<br>
#endif<br>
<br>
foreign import #{CALLCONV} unsafe &quot;sql.h SQLAllocHandle&quot; sqlAllocHandle ::<br>
  SqlHandleType -&gt; Handle -&gt; Ptr Handle -&gt; IO SqlReturn<br>
<font color="#888888"><br>
Alistair<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div></div>