I have not used DXE myself, so my thoughts could be inaccurate
Some general thoughts:
- DXE loader has no way to found symbols of running executable (which requests to load DXE) unless
one tells where they are located
- linking DXE directly with libraries (like libstdcxx.a or libc.a) will
cause duplicate copy of symbols.
I tried to run DXE3RES under x86_64 Linux, but is seems that DXE3RES is broken when compiled for
64-bit systems:
[andris@ap ~]$ i686-pc-msdosdjgpp-dxe3res -o tmp.c /usr/i686-pc-msdosdjgpp/lib/libc.a
/usr/i686-pc-msdosdjgpp/lib/libc.a: Exec format error
- DXE loader has no way to found symbols of running executable (which requests to load DXE) unless one tells where they are located
- linking DXE directly with libraries (like libstdcxx.a or libc.a)I'm not quite sure how it works exactly, but with C we just resolve
will cause duplicate copy of symbols. That is going to cause problems
when library have global state. I have seen similar problems, which
have often caused crash of program) for example in Linux, when direct
of indirect dependencies causes 2 different versions of shared library
to be loaded:
- are constructors and destructors of global objects executed, when
these objects belong to DXE? It seems from source code, that they
could. It is perhaps safer to verify that it actually works
I think one should avoid linking DXE with library directly, but
provide symbol list generated by DXE3RES (or manually) instead.
Exception could be if DXE module is only user of library, but program
itself does not use it
I tried to run DXE3RES under x86_64 Linux, but is seems that DXE3RES is
broken when compiled for
64-bit systems:
[andris@ap ~]$ i686-pc-msdosdjgpp-dxe3res -o tmp.c
/usr/i686-pc-msdosdjgpp/lib/libc.a
/usr/i686-pc-msdosdjgpp/lib/libc.a: Exec format error
You should run dxe3res against a dxe module, not an archive,
like: dxe3gen -o tmp.c my.dxe
Good Morning Andris,
- DXE loader has no way to found symbols of running executable (which requests to load DXE)Correct, you need a DXE_EXPORT_TABLE with DXE_EXPORT(func/var) to resolve at run time. See
unless one tells where they are located
https://bitbucket.org/neozeed/q2dos/src/master/dos/dxe.c for an example if interested.
- linking DXE directly with libraries (like libstdcxx.a or libc.a) will cause duplicate copy ofI'm not quite sure how it works exactly, but with C we just resolve everything like above, which
symbols. That is going to cause problems when library have global state. I have seen similar
problems, which have often caused crash of program) for example in Linux, when direct of
indirect dependencies causes 2 different versions of shared library to be loaded:
seems to be the correct way. With C++ things are trickier and we have to do -lstdcxx -lgcc or we
get mangled names that can't even be exported.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 353 |
Nodes: | 16 (2 / 14) |
Uptime: | 23:28:42 |
Calls: | 7,648 |
Calls today: | 4 |
Files: | 12,809 |
Messages: | 5,698,103 |