[fpc-pascal] uses myunit in '../src/myunit.pas' ?

Tim Veldhuizen tim at timveldhuizen.nl
Sun Feb 12 08:33:23 CET 2017


Indeed, I can confirm Delphi does this. I think since 2009 or XE or so, 
but AFAIK it doesn't need to. It does it only for the files that are 
explicitly added to the project, but those are also in the dproj file. 
And it would compile just fine without explicitly referring to the files 
in the dpr file, so I'm not exactly sure why it does it. Perhaps it's a 
kind of optimization for the caching system in the IDE..

For units that contain a form, there is also the name (value of the name 
property, not the classname if I recall correctly) of the form in curly 
braces comment behind the file reference and it seems the IDE does 
something with that as well. I can't remember clearly, but I recall an 
odd anomaly in a big application with lots of legacy that had something 
to do with such a comment for a unit with a form.


On 12/02/17 15:07, Lars wrote:
> On Sat, February 11, 2017 5:56 am, Fred van Stappen wrote:
>> Unit names are considered to be unique, so strictly, for the compiler
>> there is no need to specify the path explicitly in code when the unit path
>> is given to the compiler when calling it from the command line.
>>
>> To do this, use the -Fu parameter when calling fpc to include ../src to
>> the unit path.
>>
>> Greetings,
>> Tim Veldhuizen.
>>
>>
> I have found some use cases for hard coded paths in the source files..
> although these use cases are rare. I think even delphi main project DPR
> file does this, if I remember correctly, but I found other uses cases
> other than that.  One example might be when you are writing a quick
> program and don't want to send in a whole bunch of -Fu options and go into
> dialog boxes in lazarus configuring it, so you just quickly write it in
> your program ../someunit instead of configuring -Fu which can be obnoxious
> and tedious.. But that's just one use case. Another use case, AFAIR was a
> build system instead of gnu make.
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list