In Scurry, I select the CALLCONV on the CPP command line. This might be better if it'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: 'Times New Roman'; 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: 'Times New Roman'; 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 >= 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"><<a href="mailto:alistair@abayley.org">alistair@abayley.org</a>></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 <<a href="mailto:johan.tibell@gmail.com">johan.tibell@gmail.com</a>>:<br>
<div class="im">><br>
> foreign import CALLCONV unsafe "send"<br>
> c_send :: CInt -> Ptr a -> CSize -> CInt -> IO CInt<br>
><br>
> Compiling results in:<br>
><br>
> parse error on input `CALLCONV'<br>
<br>
<br>
</div>This is what we use in Takusen's Database.ODBC.OdbcFunctions.hsc:<br>
<br>
#ifdef mingw32_HOST_OS<br>
#let CALLCONV = "stdcall"<br>
#else<br>
#let CALLCONV = "ccall"<br>
#endif<br>
<br>
foreign import #{CALLCONV} unsafe "sql.h SQLAllocHandle" sqlAllocHandle ::<br>
SqlHandleType -> Handle -> Ptr Handle -> 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>