doh, i was just missing "where" after module... in my .chs file, and some other syntax errors...
On 9/30/06, Anatoly Yakovenko <[EMAIL PROTECTED]> wrote:
I am trying to figure out how to use c2hs, so I wrote a wrapper for asin from math.h: $ cat ASin.chs module MySin (mysin) import C2HS #include "math.h" asin::Double -> Double asin xx = {#call fun asin#} xx and this is my main: $ cat Main.hs module Main where import ASin main = do putStrLn $ show $ asin 0.5 `c2hs ASin.chs` generates this: $ cat ASin.hs -- GENERATED by C->Haskell Compiler, version 0.14.5 Travelling Lightly, 12 Dec 2005 (Haskell) -- Edit the ORIGNAL .chs file instead! {-# LINE 1 "ASin.chs" #-}module MySin (mysin) import C2HS asin::Double -> Double asin xx = asin xx foreign import ccall safe "ASin.h asin" asin :: (CDouble -> CDouble) but, when i try to build the wone thing, i get an error that i dont understand: $ ghc -v --make -fffi Main.hs Glasgow Haskell Compiler, Version 6.4.2, for Haskell 98, compiled by GHC version 6.4.2 Using package config file: /usr/lib/ghc-6.4.2/package.conf Hsc static flags: -static *** Chasing dependencies: Chasing modules from: Main.hs *** Deleting temp files Deleting: ASin.chs:2:0: parse error on input `import' So, what am i missing?
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe