Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Link with Dynamic RTL for 64-bit app


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Matt McNabb

Posts: 21
Registered: 6/9/11
Link with Dynamic RTL for 64-bit app  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 22, 2014 2:49 AM
Summary: Using C++Builder XE5 Update 2:
- The "Link with dynamic RTL" seems to be ignored for 64-bit builds, and the UsePackages option controls whether dynamic RTL is linked. Can anyone else confirm this as it is not mentioned in the documentation?

Background:

I have successfully converted my app (one .EXE and four COM .DLL) to 64bit with "UsePackages" being "false", i.e. full static linking. It seems to run correctly, both standalone and in the debugger.

However this creates quite large executables; in my case the total sum of these five binaries in release mode is 59.0 MB; whereas if I build in release mode with "UsePackages=true" then total is 7.8 MB.

My project includes three static libraries, and as I noted on another thread (https://forums.embarcadero.com/thread.jspa?threadID=105454) , the static libraries definitely do completely ignore the "Link with dynamic RTL" checkbox; and they decide based on a "UsePackages" setting in the .cbproj file which is not controllable from the IDE.

If I also go and manually edit the cbproj files so that they all have UsePackages=true, the total size of binaries is just 6.1MB. So a tenth the size of the static linked version. This is a significant gain so I would like to get to the bottom of just what is going on here.

My application does actually seem to work correctly even if I built the static libs with UsePackages=false, but the exe/dll that link to them with UsePackages=true. I'm not sure why this works, so I guess this means I do not understand exactly what it means to dynamically link the RTL. How does it work that some functions can link against static RTL and some functions can link against dynamic RTL; wouldn't that mean that they use different memory allocation pools?

The dynamic RTL appears to be selected solely by the "UsePackages" checkbox. If "UsePackages" is checked, then the compiler commandline has "-D_RTDLL -DUSEPACKAGES" on it; and the binary ends up with dependency on "rtl190.bpl", "borlndmm.dll", and "cc64140mt.dll". This happens even if I leave the list of packages empty when checking "UsePackages" checkbox. (I am checking dependencies both via Dependency Walker, and via looking at the list of module load messages when starting the executable from the IDE).

I have had another problem also. When experimenting with UsePackages=true, I tried reducing the default list of packages. If I trim it down to just "fmx;rtl;vcl" then everything builds correctly but it segfaults on running (0xC0000005). In debug mode the segfault comes during construction of object vtables. However the binaries do not have any new dependencies other than the three RTL files, and vcl190.bpl. So I don't know what is going on here but I guess I should not try to mess with this list of packages.

Edited by: Matt McNabb on Jun 22, 2014 2:50 AM

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02