www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/21/12:59:06

From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Loadable Modules
Date: Sat, 21 Sep 1996 15:51:10 GMT
Lines: 102
Message-ID: <843321029.852.1@abwillms.demon.co.uk>
References: <32432BD4 DOT 1ABE AT spy DOT isp DOT nsc DOT ru>
NNTP-Posting-Host: abwillms.demon.co.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ryzhenkov Ilya <ilya AT spy DOT isp DOT nsc DOT ru> wrote:

>I'm sorry, but copyrights of answers was not preserved ;))

I won't sue :-)

>========================== Overview =================================

<snip>

:-} Wierd Deja-Vu sensation!

>==================== End of Overview ==================================

Right, back to the serious world.

>I see the following needs for now :
>1. We must either use .o & .a files as modules or in some tricky way instruct   
>   linker not to generate "unresolved reference" error and process them 
>   in some way.

Agreed, unless we dump COFF for ELF (big step).

>2. We need COFF executable format as well as .o and .a formats

For the 'initial module' only, as long as there's a mechanism for it
to export things like printf.

One alternative is to provide a COFF loader (whoa... the stub loader
loads the COFF loader which loads the modules! :-) which is written
without reference to libc, to make it as small as possible (all direct
DPMI ints and transfer buffering) which then creates the
linked-modules environment.

>3. We need an idea of API.

I'd be inclined to borrow the Linux DLL API.
It goes sorta like:

library l = open_lib("filename");
void (*myfunc)(int a) = (void (*)(int))scan_lib(l,"myfunc");
myfunc(1);
close_lib(l);

(I think.)

That's as well as the automatic linkage feature.

>4. We need an idea of how to create module dependencies.

Have a library list all its dependencies, or just make sure they're
loaded before using them.

Method 1:

Use a special section to contain dependency strings:

char my_libs[] __attribute__ ((section ("DEPEND")))

char my_libs[] = "LPT";

Method 2:

have the module's 'init' function (called when it's loaded) do it:

int main() {
   ensure("LPT");
}

ensure is as in the RiscOS "RMensure" which does the same thing
(ensure a module is loaded).

>1. Does go32 sources available from anywhere ?

Yeah, I guess so... go grepping around the v1 subdirectory of a DJGPP
simtel mirror.

>2. What is the startup sequence of djgpp-compiled program ?
>   I mean, the sequence of calling constructors of static and global objects,
>   calling main and other stuff.

Best download the DJGPP library sources; many of the clues leading
towards a LM system are in there. Look for djlsr*.zip, AFAIR.

>3. Can you imagine DJGPP operating system on the top of DOS ? ;-)

Can't wait :-)

Regards,


ABW
---

COMPUTER: We are in position over the Rebel homeworld.
VADAR: Engage the Death Star primary weapon, let those rebel worms die!
COMPUTER: Sorry, your evaluation version of Battle Computer 3.0 has expired. 
          Please send 2.6 billion dollars to the address in REGISTER.TXT

Alaric B. Williams Internet : alaric AT abwillms DOT demon DOT co DOT uk
<A HREF="http://www.abwillms.demon.co.uk/">Hello :-)</A>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019