[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shared Libs for MiNT



|> Date: Mon, 12 Dec 94 11:35:17 +0100
|> X-Sender: jorisw@malpighi
|> Mime-Version: 1.0
|> Content-Type: text/plain; charset="us-ascii"
|> From: Joris.Welkenhuysen@uz.kuleuven.ac.be (Joris Welkenhuysen)
|>
|> [stuff deleted]
|> I think the best solution would be if we somehow could force the linker to place
|> the global variables declared by the shared library at the start of each
|> program's
|> global data segment. That way, we don't have to fiddle with A4 when
|> traversing the border between shared lib and program.

No; this won't help in the general case. Consider the following: One
program will use the shared libraries (sorry for using Un*X library
names, but I really dislike the *.olb convention used under MiNT, it
provides porting headaches from time to time :-) libc.a and libbsd.a,
another would include libc.a and libm.a and a final program include
libc.a, libbsd.a and libm.a. Now there is no way to allocate the
libraries global variables in a way that they will have the same
offset in all of the programs!

So I can't see a way to avoid fiddling with the base register in an
implementation of shared libraries. As a consequence of this a
function cannot be represented with its entry point alone; we also
require a pointer to routine's global data to fully describe the
function. (Functional programming experts would probably call this a
closure :-) Under AIX, for example, these structures are called
function pointers. Thus when passing a function argument we would have
to construct such a function pointer and pass it instead of the entry
point.

Obviously accessing global variables declared in a shared library will
then need an extra level of indirection, too, as someone else already
pointed out.


Regards Wolfgang

---
Wolfgang Lux				#include <Standard Disclaimer>
WZH Heidelberg, IBM Germany             Internet: lux@heidelbg.ibm.com
+49-6221-59-4546			VNET:     LUX at HEIDELBG
+49-6221-59-3300 (fax)			EARN:     LUX at DHDIBMIP