Hi,

I have the following strange situation. I am running GHC(i)
5 on Solaris.

I have the following files:

  primtk.c
  PrimTk.hs
  Yahu.hs

Where

  * "primtk.c" defines some C functions,

  * "PrimTk.hs" contains the "foreign import" declarations
    of these functions, and

  * "Yahu.hs" is a Main module that uses "PrimTk.hs".

When I compile everything in the following way:

  > gcc -c primtk.c -o primtk.o
  > ghc primtk.o --make Yahu.hs

The resulting executable works fine!

However, when I try to do the same thing in GHCi:

  > gcc -c primtk.c -o primtk.o
  > ghci primtk.o Yahu.hs
  ...

Everything loads as expected (!), I can even run the
program, but unfortunately, while running my program, the
string constants (data part) in primtk.c/primtk.o get
overwritten by other functions.

My question is: is this a bug in the dynamic linking of
static object files in GHCi?

If so, I'd be happy to send the source files, (though there
are rather many of them.)

If I am not supposed to do it in this way, please tell me
how I am supposed to do it. I tried the following:

  > gcc -c primtk.c -fPIC -shared -o primtk.so
  > ghci primtk.so Yahu.hs
  ...

But then, GHCi complains about "primtk.so", it does not
recognize it as a dynamic object file. (Which it strange,
because there is an error message that identifies ".so"
files as valid arguments to GHCi...)

/Koen.

--
Koen Claessen         http://www.cs.chalmers.se/~koen
phone:+46-31-772 5424      mailto:[EMAIL PROTECTED]
-----------------------------------------------------
Chalmers University of Technology, Gothenburg, Sweden


_______________________________________________
Glasgow-haskell-bugs mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to