RTS interface followup...

Keean k.schupke@ic.ac.uk
Wed, 17 Jul 2002 11:05:22 +0100


The code (which is what I am assuming is where the error is comming from) is
lifted
from Linker.lhs, namely (lookupSymbol :: CString -> IO (Ptr a)) this is used
in the
following:

	hobj <- lookupSymbol c_objsym
	case hobj of
	o | o == nullPtr -> return Nothing
	Ptr o -> case (addrToHValue# o) of
		(# h #) -> return (Just h)

[I am not 100% certain this is where the error is comming from - but its the
only
reference to an Addr I can find...]

this compiles fine, however in the final link (i'm doing a 2 stage compile
with -c to
generate all the .o files then a link - using ghc) the following error is
generated:

.../ghc-5.04/libHSrts.a(RtsAPIDeprec.o): In function 'rts_mkAddr':
RtsAPIDeprec.o(.text+0x14): undefined reference to 'Addr_Azh_con_info'

...same for rts_getAttr, with the addition of the symbol
Addr_Azh_static_info
which is also undefined...

	Hope this makes it a bit clearer. A second problem I have just found -
using
a threaded runtime, my code now hangs after getting a connection on a
socket, and forking
a haskell-thread to handle it. The reply is not sent until another
connection attempt
occurs... where does the behavior of the threaded runtime differ from the
non-threaded?

	Keean Schupke
	Department of Electrical & Electronic Engineering,
	Imperial College.

-----Original Message-----
From: Simon Marlow [mailto:simonmar@microsoft.com]
Sent: 17 July 2002 10:40
To: k.schupke@ic.ac.uk; glasgow-haskell-users@haskell.org
Subject: RE: RTS interface followup...


> Have got the rts stuff to compile by including
> .../ghc-5.04/HSlang.o on the
> compile command line. I think this means the linker is not
> including the
> object
> with defines Addr_Azh_con_info when it links the library (only objects
> actually
> referenced from an archive library get included in the final
> binary) however
> including
> the .o forces all the code in the library to be included. It
> looks like a
> problem with
> the arguments ghc passes to the linker, however passing -optl
> --undefined
> Addr_Azh_con_info
> (should force the linker to output the code containing the
> definiton) made
> no difference,
> so I'm a little confused by that.

I'm a bit hazy about this - I remember you were working on doing some
dynamic linking of Haskell code, but could you explain in more detail
exactly what it is you're doing, and at what point the error is
generated?

The Addr type is deprecated, so please don't use it if possible.

Cheers,
	Simon