[an error occurred while processing this directive]
Node:DXE,
Next:LFN,
Previous:go32-v2,
Up:Miscellany
Q: What is a DXE?
Q: Can I make a DLL using the DXE support?
Q: Where can I find information or examples about writing/loading
the DXE files?
Q: Why do I get undefined references when I run dxegen
?
A: DXE is a limited facility to dynamically load code which is rarely needed in DJGPP. An example is the floating-point emulator code (see the details of DJGPP FP emulator) which is only used on those few machines that lack an FPU. The DXE design is intentionally limited to keep it as simple as possible, so that the code that loads a DXE could be small (it's a few hundreds bytes). Because of this, there are a number of limitations in the DXE mechanism that prevent using it for full-fledged dynamic linking (i.e., a DLL). For instance, the DXE module cannot access variables or functions in the main module.
A DXE cannot link in any library functions which reference static
variables (or which call other routines which reference static
variables); this effectively prohibits linking in I/O functions,
allocating memory, and many other useful things. If you do call any of
these, you'll get unresolved externals from dxegen
. To work
around this limitation, introduce an array of function addresses, or a
structure with pointers to functions as its members, which will be used
from the DXE at run time to call the "special" routines you cannot
link in. Then arrange for the address of this array to be returned by
_dxe_load
when it loads the DXE, and make the init routine fill
the array with the actual addresses of those "special" functions.
Unloading a DXE is also not supported (but I'm told you can add this by making a few simple changes in the C library).
The only place you can find some docs and examples of writing and using a DXE is in the "tests" archive. The example there is exceedingly simplistic, but then so is the entire DXE mechanism....