Jump to content
Ian Branch

Source still built even though the DCUs are first in the path..

Recommended Posts

Hi Team,

I was/am under the understanding that if I build a function library such that the DCUs are in a bin directory, add it to Delphi, and add the bin and source directories, in that order, the source should not be rebuilt with the App if an element of the library is used.

 

Is this the case?

 

The reason for the question is that this is not what is happening here.

 

Regards & TIA,

Ian

Share this post


Link to post

If you build a project, all visible sources are compiled. 

 

Only when you just compile a project where the dcu and source are both available, the source is compiled only when its time stamp or memory content is newer than the binary.

 

If you don't want to compile any library sources but always use the binary, you must remove the source from Tools > Options > Language > Delphi > Library > Library path as well as from Project > Options > Building > Delphi-Compiler > Search Path.

 

Unfortunately that removes the ability to debug the library sources. To fix that, you have two options. Which you choose depends on where you add the binaries folder:

 

A: Tools > Options > Language > Delphi > Library > Library path: Add the source folder to Browsing path in the same dialog.

B: Project > Options > Building > Delphi-Compiler > Search Path: Add the source folder to Project > Options > Debugger > Source Path

 

Obviously, solution A affects all projects, while B affects the current project only.

 

Note: You have to compile the library with debug options to make that work.

 

With solution A you can separate the debug binaries from the release ones by placing the debug binaries in a separate folder (just as the Delphi lib folder is organized) and add the debug binaries folder to the Debug DCU path entry of Tools > Options > Language > Delphi Options > Library. This will allow to use the debug binaries when the Use debug .dcus option is set in Project > Options > Building > Delphi-Compiler > Compiling.

  • Like 1
  • Thanks 2

Share this post


Link to post

Ahhh.  Thank you Uwe for the clarification and options.

Much appreciated.

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

×