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

2017-02-11 Thread Fred van Stappen
Hello Tim.


OK, many thanks for your light.


Fre;D


De : fpc-pascal-boun...@lists.freepascal.org 
 de la part de Tim Veldhuizen 

Envoyé : samedi 11 février 2017 06:04
À : fpc-pascal@lists.freepascal.org
Objet : Re: [fpc-pascal] uses myunit in '../src/myunit.pas' ?

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.

On 11/02/17 04:07, fredvs wrote:
> Hello.
>
> There is myprogram.pas in /home/me/myproject/example.
>
> This program uses myunit.pas from /home/me/myproject/src.
>
> myunit.pas uses myunit2.pas and myunit3.pas that are also in
> home/me/myproject/src.
>
> Using this:
>
> program myprogram;
> ...
> uses myunit in '../src/myunit.pas';
>
> load indeed /home/me/myproject/src/myunit.pas but there are error messages
> because myunit.pas does not find the units that are in uses section.
>
> Here myunit.pas:
>
> unit myunit;
> ...
> uses myunit2, myunit3;
> ...
>
> How to do ?
>
> Thanks.
>
> Fre;D
>
>
>
>
> -
> Many thanks ;-)
> --
> View this message in context: 
> http://free-pascal-general.1045716.n5.nabble.com/uses-myunit-in-src-myunit-pas-tp5727626.html
Free Pascal - General - uses myunit in '../src/myunit.pas' 
?
free-pascal-general.1045716.n5.nabble.com
uses myunit in '../src/myunit.pas' ?. Hello. There is myprogram.pas in 
/home/me/myproject/example. This program uses myunit.pas from 
/home/me/myproject/src. myunit.pas uses myunit2.pas and...



> Sent from the Free Pascal - General mailing list archive at Nabble.com.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
fpc-pascal Info 
Page
lists.freepascal.org
NOTE * Due to incidents with spambots subscribing to the list and spamming 
it, your first message(s) may be delayed a bit before ...




___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
fpc-pascal Info 
Page
lists.freepascal.org
NOTE * Due to incidents with spambots subscribing to the list and spamming 
it, your first message(s) may be delayed a bit before ...



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

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

2017-02-11 Thread Lars
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@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


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

2017-02-11 Thread Tim Veldhuizen
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@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal