If I link

  import Addr (Addr, nullAddr)

  foreign import ccall "foo" foo :: Int -> Addr -> IO ()

  main = foo (id 32) nullAddr

with

  void foo (int x, char *y)
  {
    printf ("foo: x = %d; y = %xl\n", x, (long) y);
  }

I get

  foo: x = 134516888; y = 0l

It is the combination of there being at least two arguments
plus the fact that the first argument has to be forced,
which seems to cause the problem.  In other words, if I
remove `id', it works, and if I remove the second argument
(the address), it also works.  If the second argument is
another `Int', the problem remains the same (so it doesn't
seem to be the type of the second argument, but the fact
that there is a second argument).

This is with GHC 4.01 on a Pentium Linux box; so, 

  I_ = StgInt = StgInt32 = signed int

Manuel

Reply via email to