Jump to content
gioreva

Stand alone EXE

Recommended Posts

Posted (edited)

Hi

 

With RAD Builder 11, how can I create a .exe Stand Alone ?

Including all libraries.

 

Or how can I easily export the program to another PC without doing specific setups ?

Maybe I could do a setup with just the libraries.

Edited by gioreva

Share this post


Link to post

Which libraries are you referring to? If you mean the Delphi Run Time Library, bundled VCL or FMX components, and third-party components, then Delphi builds a standalone EXE by default. There is an option to use run-time packages, which reduce the size of your EXE but require distributing those packages with your EXE:

 

image.thumb.png.7ee5806dafcbe3b766536a25ffa78678.png

 

If you are referring to libraries that are not Delphi/Object Pascal code, then you need to be more specific with your question.

Share this post


Link to post
Posted (edited)
8 hours ago, gioreva said:

With RAD Builder 11, how can I create a .exe Stand Alone ?

Including all libraries.

For both Delphi and C++:

  • Project > Options > Packages > Runtime Packages
    • "Link with runtime packages" = false

If you are making a C++ project, you'll also need:

  • Project > Options > Building > C++ Linker
    • "Link with Dynamic RTL" = false
    • "Link with the Delphi Runtime Library" = false

 

Note that with these settings, Packages will be built into the EXE so you don't have to deploy any BPLs.  But, if your code (or any of its dependencies) require external DLLs, you will still have to deploy those with your EXE.

Quote

Or how can I easily export the program to another PC without doing specific setups ?

Maybe I could do a setup with just the libraries.

At the bare minimum, you could just zip up all of the binaries and extract them to a folder on the target machine.  But why would you not want to use a setup package that handles this for you?

Edited by Remy Lebeau

Share this post


Link to post

I cannot find the delphi option.

Now, the .exe has gone from 300Kb to 2Mb, but it no longer asks me for .bpl

It is still telling me that they are missing:

BORLNDMM.DLL
C32C280MT.DLL

 

If I copy BORLNDMM.DLL
App says, "error, cannot execute"

I cannot find the file C32C280MT.DLL anywhere.

 

image.thumb.png.4bd267836252864dc4017047b15c5923.png

Share this post


Link to post

Ok, using 32 bit/redist file now work.

Trying on SandBox, System Info told me it was 64-bit

Is there no way to omit these DLLs?
And to run the programme on both 32-bit and 64-bit PCs?

 

image.thumb.png.04287b7a5cc7c24093327f6ae5efcaf7.png

Share this post


Link to post
51 minutes ago, gioreva said:

Now, the .exe has gone from 300Kb to 2Mb

That is to be expected with a standalone EXE.

51 minutes ago, gioreva said:

It is still telling me that they are missing:

BORLNDMM.DLL
C32C280MT.DLL

It should not need those DLLs if you have disabled all of the options I mentioned earlier. Are you sure you did it in all of your build configurations? Did you do a full rebuild? Are you sure you are simply not running an older version of the EXE?

15 minutes ago, gioreva said:

And to run the programme on both 32-bit and 64-bit PCs?

To run a single EXE on both types of PCs, you have to compile the EXE for 32bit only, not for 64bit. Make sure you have the 32bit platform active in your project's Target Platforms settings. 

Share this post


Link to post
Posted (edited)

I apologise, I had not done the linker ones.

Thanks for your help.

Now it's 3.5Mb and everything works.

Is there a way to optimise the code more and reduce the size?

Edited by gioreva

Share this post


Link to post
1 hour ago, gioreva said:

I apologise, I had not done the linker ones.

Thanks for your help.

Now it's 3.5Mb and everything works.

Is there a way to optimise the code more and reduce the size?

Turn off (remote) Debug symbols in the linker options, if it is turned on.

Share this post


Link to post
1 hour ago, dummzeuch said:

Turn off (remote) Debug symbols in the linker options, if it is turned on.

Or set the options to put debug info in a separate file to be able to use a debugger without having the debug info in the EXE. The image below is Delphi 11.3. The option may be named or placed differently in various versions of Delphi.

 

image.thumb.png.6d76071bbca1596d9c4cb8755dbad11a.png

Share this post


Link to post
Posted (edited)
4 hours ago, gioreva said:

It is still telling me that they are missing:

BORLNDMM.DLL

BORLNDMM.DLL should only be needed if an EXE or DLL Delphi project has ShareMem in the project's uses clause (in the .dpr file). If that is needed and you are on a recent version of Delphi, replace ShareMem with SimpleShareMem. Related documentation is at https://docwiki.embarcadero.com/RADStudio/Athens/en/Sharing_Memory

Edited by JonRobertson

Share this post


Link to post

Removed Full debug information, and debug information, but same 3.5Mb

I cannot find any memory memory in any setup.

image.thumb.png.2f95a38f7b832507708bf55604a1da00.png

image.thumb.png.dcfbb5c8dc3848f66652915f2dd7c61a.png

Share this post


Link to post

Some of these suggestions don't apply to C++ Builder.

  • Sad 1

Share this post


Link to post
6 hours ago, gioreva said:

Is there a way to optimise the code more and reduce the size?

Not a whole lot, unfortunately.  Trimming the debug info helps a lttle, but most of the size is just RTL bloat, Unicode, DFMs, RTTI, etc.  In Delphi, it is possible to reduce some of the RTTI a little, but not in C++Builder, AFAIK.

Share this post


Link to post
45 minutes ago, David Heffernan said:

Why do you need a smaller exe? 

No, no problem.

It's OK.

thanks

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×