www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/09/24/20:22:32

From: alaric AT abwillms DOT demon DOT co DOT uk (Alaric B. Williams)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: COFF and ELF exec formats
Date: Tue, 24 Sep 1996 18:05:47 GMT
Lines: 126
Message-ID: <843588301.13120.0@abwillms.demon.co.uk>
References: <Pine DOT SUN DOT 3 DOT 93 DOT 960922124049 DOT 380A-100000 AT napier DOT uwaterloo DOT ca> <524dag$q3n AT lastactionhero DOT rs DOT itd DOT umich DOT edu> <524jlf$ph9 AT client3 DOT news DOT psi DOT net>
NNTP-Posting-Host: abwillms.demon.co.uk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

dan AT dan DOT emsphone DOT com (Dan Nelson) wrote:
>shared coff libraries for years.  The object format doesn't really
>matter.

Is there a POSIX standard function call interface to comply to?

There is some demand to be like Linux, but that could be impractical
under DOS, where the thing would be fundamentally different anyway.

An easier scheme would be to use .dxes with main functions that simply
register entry points and dependencies. Ok, it wouldn't be pretty, but
it'd be easy!

A good set of macros would help. Perhaps a table of exports built up
in another section, so we could write:

void myfunc(int xxx,int yyy) {
...
}

EXPORT(myfunc);


The EXPORT places a record in section ".exports" of the form:

(pointer)(asciiz name)

We can also write:

void (*myfunc)(int xxx,int yyy);

IMPORT("mylib",myfunc);

for an implicit import (recorded in ".imports".)

We can always, at runtime, perform a:

myfunc = (void(*)(int xxx,int yyy))import("mylib","myfunc");

A function called in the DXE's "main" would set up all the ".exports"
and ".imports" section's bits.

Oh, yeah, we'd better support library versions like Linux does! In the
filename? Or could the DXE format be extended to have a field for
this?

Example:

--------INTADD.C----------------

#include "dll.h"

int integer_sum(int a,int b) {
	return a+b;
}

EXPORT(integer_sum);

void libmain() {
	/*other initialisation*/
	register("intadd");
}

---------VECTADD.C-------------------

#include "dll.h"

int (*integer_sum)(int a,int b);
IMPORT("intadd",integer_sum);

void vector_sum(int *a,int *b,int *c,int n) {
	int i;
	for(i=0;i<n;i++)
		c[i] = integer_sum(a[i],b[i]);
}

EXPORT(vector_sum);

void libmain() {
	register("vectadd");
}

--------------------------------------

Other considerations:

Many libraries with the same protocol (ie print drivers); we could
make use of file extension conventions. IE:

*.INT are software-internal modules, of unknown protocol.
*.SHL are shared libraries, the name specifies the protocol (ie ZLIB)

Then for agreed protocols, we choose extensions:

*.PDR are printer drivers
*.GDR are graphics drivers
*.GFM are graphics file format plugins
*.CRP are cryptosystems
*.CMP are compressors

There's great scope for conflict; a field in the DXE header would be
nice as well, to complement this and distinguish my printer drivers
from someone else's disasterously different printer drivers. Perhaps
we make it an implicit rule that new format announcements are posted
to c.o.m.d BEFORE going into development, and somebody maintains a
list - so nobody does the same thing twice!

Nonetheless, an 8 character type ID in the DXE header, along with a
version ID, would be desireable.

Whew, that's a long one for me!

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