oops .. my bad ...
If I change data Sigval = SivalInt Int
to newtype Sigval = SivalInt Int
OR
data Sigval = SivalPtr (Ptr Char)
to newtype Sigval = SivalPtr (Ptr Char).
Why should "newtype" instead of a data type allow my test case to build?
Vasili
On Fri, Jun 13, 2008 at 10:59 PM, Galchin, Vasili <
vigalchin@gmail.com> wrote:
If I change
data Sigval = SivalInt Int | SivalPtr (Ptr Char)
to ...
newtype Sigval = Sivalint Int | SivalPtr (Ptr Char)
then my test case builds and links. ??
Regards, Vasili
On Mon, Jun 9, 2008 at 11:01 PM, Galchin, Vasili <
vigalchin@gmail.com> wrote:
I have tried various things to no avail ....
vigalchin@ubuntu:~/FTP/Haskell/unix-2.2.0.0/tests/timer$ runhaskell Setup.lhs build
Preprocessing executables for Test-1.0...
Building Test-1.0...
[1 of 1] Compiling Main ( ./timer.hs, dist/build/timer/timer-tmp/Main.o )
./timer.hs:22:0:
Unacceptable argument type in foreign declaration: Sigval
When checking declaration:
foreign import ccall safe "wrapper" mkNotify
:: Notify -> IO (FunPtr Notify)
=> here is my Sigval def
data Sigval = SivalInt Int | SivalPtr (Ptr Char)
I did a find/grep for "Unacceptable argument" in the ghc compiler source and assuming no typo I didn't find. ??
Thanks.
Kind regards, Vasili
2008/6/9 Galchin, Vasili <vigalchin@gmail.com>:
> Ryan,
>
> I tried but the compiler didn't seem to like the keyword "import":
>
> vigalchin@ubuntu:~/FTP/Haskell/unix-2.2.0.0/tests/timer$ runhaskell
> Setup.lhs build
> Preprocessing executables for Test-1.0...
> Building Test-1.0...
> [1 of 1] Compiling Main ( ./timer.hs,
> dist/build/timer/timer-tmp/Main.o )
>
> ./timer.hs:29:8: parse error on input `import'
>
Hi Vasili,
To fix that error, you probably just need to add the line "Extensions:
ForeignFunctionInterface" to the .cabal file. (That is the
equivalent of calling ghc by itself with the command-line arguments
-fffi or -XForeignFunctionInterface.)
Hope that helps,
-Judah