delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2023/01/28/06:02:11

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
Received-SPF: neutral (johanna4.inet.fi: domain iki.fi is neutral about
designating 84.248.104.250 as permitted sender) identity=mailfrom;
receiver=johanna4.inet.fi; client-ip=84.248.104.250;
envelope-from=andris DOT pavenis AT iki DOT fi; helo=[192.168.1.10];
Message-ID: <496da509-6d4f-88a1-e94a-6c330a915f05@iki.fi>
Date: Sat, 28 Jan 2023 12:58:52 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
To: "DJGPP List (E-mail)" <djgpp AT delorie DOT com>
From: "Andris Pavenis (andris DOT pavenis AT iki DOT fi) [via djgpp AT delorie DOT com]" <djgpp AT delorie DOT com>
Subject: Linking DXE3 with libraries
Reply-To: djgpp AT delorie DOT com

Thread GXE3 with std::vector has grown bit too long, so I'm beginning a new one

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. 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:

- there is a wat how to provide symbols of executable (including ones from libraries) when loading DXE:

      - http://www.delorie.com/djgpp/v2faq/faq22_15.html

      - https://www.delorie.com/djgpp/doc/utils/utils_20.html


I tried to run DXE3RES under x86_64 Linux, but is seems that DXE3RES is broken when compiled for 
64-bit systems:

[andris AT 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


Questions which should be answered to use DXE3 (I do not have answers myself, but can be easily 
tested, I'm not going to test myself):

- 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


Andris

- Raw text -


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