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: <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;iHello :-)