Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: Linking with run-time packages


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


Permlink Replies: 14 - Last Post: Apr 11, 2016 11:40 PM Last Post By: Vladimir Ulchenko
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 7, 2016 7:33 AM
Hi all,

I always build my apps without linking to run-time packages, but there are some scenario where you have to use it. I just wanna know how to link with specific packages not all of them. I mean I don't want to deploy a lot of BPL files with my EXE only the important ones, like vcl and rtl, but i don't know how to do it.

Is there a way to do this I mean to add BPL files to my project but and only deploy vcl and rtl files with exe?

--
The limits of my language mean the limits of my world
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 7, 2016 10:18 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
Ahmed wrote:

Is there a way to do this I mean to add BPL files to my project
but and only deploy vcl and rtl files with exe?

No. It is an all-or-nothing deal. The static version of packages are linked
to the static version of RTL/VCL. The dynamic version of packages are linked
to the dynamic version of RTL/VCL. You can't pick and choose to static link
to some packages and dynamic link to other packages. You either static link
to them all, or you dynamically link to them all.

--
Remy Lebeau (TeamB)
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 7, 2016 11:44 PM   in response to: Ahmed Sayed in response to: Ahmed Sayed
On Thu, 7 Apr 2016 07:33:13 -0700, Ahmed Sayed <> wrote:

I always build my apps without linking to run-time packages, but there are some scenario where you have to use it. I just wanna know how to link with specific packages not all of them. I mean I don't want to deploy a lot of BPL files with my EXE only the important ones, like vcl and rtl, but i don't know how to do it.

Is there a way to do this I mean to add BPL files to my project but and only deploy vcl and rtl files with exe?

you can choose which packages/libs should be linked statically/dynamically using ide project options and/or via #pragma comment/link right
in your sources

--
Vladimir Ulchenko aka vavan
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 8, 2016 6:08 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Can you give me examples on how to do it> Let's say i have other BPL that i want to link statically for instance:

// FireDAC230.bpl statically link this
// and dynamicly link vcl.bpl and rtl.bpl


What should i do in Project options and what i code?
--
The limits of my language mean the limits of my world
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 8, 2016 8:07 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
On Fri, 8 Apr 2016 06:08:43 -0700, Ahmed Sayed <> wrote:

Can you give me examples on how to do it> Let's say i have other BPL that i want to link statically for instance:

// FireDAC230.bpl statically link this
// and dynamicly link vcl.bpl and rtl.bpl


What should i do in Project options and what i code?

you may try to specify vcl and rtl only in Runtime packages tab within Project options window
ide is buggy and depending on version used and your luck it might work or not for you
the worst case you may need to manually edit project file outside of ide

--
Vladimir Ulchenko aka vavan
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 8, 2016 1:43 PM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
You mean to check Link with run-time packages and then specify vcl and rtl only, and as for the static linking for other packages i just add the library for instance "FireDAC230.lib" to project.

--
The limits of my language mean the limits of my world
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 10, 2016 11:29 PM   in response to: Ahmed Sayed in response to: Ahmed Sayed
On Fri, 8 Apr 2016 13:43:58 -0700, Ahmed Sayed <> wrote:

You mean to check Link with run-time packages and then specify vcl and rtl only, and as for the static linking for other packages i just add the library for instance "FireDAC230.lib" to project.

correct. sometimes you don't even need to add lib manually as ide does that automatically. but other times you may need to edit different
project file sections to get required combination

--
Vladimir Ulchenko aka vavan
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2016 1:12 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
Can you give me an example on how to do it?
--
The limits of my language mean the limits of my world
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2016 4:22 AM   in response to: Ahmed Sayed in response to: Ahmed Sayed
On Mon, 11 Apr 2016 01:12:46 -0700, Ahmed Sayed <> wrote:

Can you give me an example on how to do it?

example of fighting against ide bugs and peculiarities? ;)
iirc you didn't even mention which version of bcb you are using
I'm on rs2007 and it's been a while since I exercised such mixed linking

--
Vladimir Ulchenko aka vavan
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2016 10:36 AM   in response to: Vladimir Ulchenko in response to: Vladimir Ulchenko
I am using RAD Studio 10 seattle

--
The limits of my language mean the limits of my world
Vladimir Ulchenko

Posts: 248
Registered: 1/12/00
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2016 11:40 PM   in response to: Ahmed Sayed in response to: Ahmed Sayed
On Mon, 11 Apr 2016 10:36:57 -0700, Ahmed Sayed <> wrote:

I am using RAD Studio 10 seattle

I have no experience with this version

--
Vladimir Ulchenko aka vavan
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 8, 2016 1:58 PM   in response to: Ahmed Sayed in response to: Ahmed Sayed
Ahmed wrote:

// FireDAC230.bpl statically link this
// and dynamicly link vcl.bpl and rtl.bpl

Isn't that a bit dangerous? FireDAC relies on the RTL (almost every package
does), but the static version of FireDAC isn't compiled to use the dynamic
version of the RTL. So you could end up with two copies of the RTL in your
app, one static and one dynamic. That is a recipe for disaster.

--
Remy Lebeau (TeamB)
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 8, 2016 2:22 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Counting on linking with run-time packages so much makes RAD Studio Apps like .Net Framework you are always counting on .Net Assemblies to be installed first. With "link with run-time packages" option C++ builder & Delphi apps are the same but without a framework to be installed as prerequisites. So it is harder on with RAD Studio then .Net Apps, at least in .Net you install the whole .Net Framework and your app uses what ever .Net assembly it wants.

Embarcadero should make a new feature when you check "link with run-time packages" The exe and other required packages & other files should be automatically copied to your app exe location in a new folder besides (Debug/Release) called Deploy/ment that contains all these files so they can save time for the developer.

--
The limits of my language mean the limits of my world
Jan Dijkstra

Posts: 206
Registered: 11/4/99
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2016 4:40 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Remy Lebeau (TeamB) wrote:
Ahmed wrote:

// FireDAC230.bpl statically link this
// and dynamicly link vcl.bpl and rtl.bpl

Isn't that a bit dangerous? FireDAC relies on the RTL (almost every package
does), but the static version of FireDAC isn't compiled to use the dynamic
version of the RTL. So you could end up with two copies of the RTL in your
app, one static and one dynamic. That is a recipe for disaster.

--
Remy Lebeau (TeamB)

And yet, the default installation of XE8 enterprise has the setup of dynamically linking with the RTL and VCL, while all of FireDAC is statically linked. Didn't even realise this was happening until I started debugging. I could single step into the pascal source code of FireDAC, but couldn't in the rest of the RTL/VCL.

After some poking around (using process explorer) I found out FireDAC wasn't dynamically linked at all. I had to manually add the firedac package .bpi's to my test project to make it link dynamically. And, with that, the option of stepping into the FireDAC source disappeared as well.

Mind you, this was a one shot deal. Either all of FireDAC needs to by dynamically linked, or none of it. If you mix, you get access violations.
Ahmed Sayed

Posts: 173
Registered: 8/9/07
Re: Linking with run-time packages  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 11, 2016 10:39 AM   in response to: Jan Dijkstra in response to: Jan Dijkstra
So, now what i have to do is add any packages .lib files to the project to static link them and only select vcl and rtl in "Link with run-time packages" option an deploy them with the exe. Will this do it for me? or is there something else i should do?

--
The limits of my language mean the limits of my world
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02