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

2017-02-12 Thread noreply

On 2017-02-12 01:33, Tim Veldhuizen wrote:

Indeed, I can confirm Delphi does this. I think since 2009 or XE or
so,


I'm too lazy to check right now, but I think even delphi 5 and such used 
paths in the dpr (project) file


Would be interesting to find out the real reason, but once again, I'm 
too lazy to head down that path and post a question on stackoverflow 
(plus, they would likely shut it down as off topic or irrelavent, 
knowing those turds)

___
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-12 Thread Mattias Gaertner
On Sun, 12 Feb 2017 15:33:23 +0800
Tim Veldhuizen  wrote:

> 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..

Delphi uses them just a marker for the IDE, that the units belongs
to the project. It does not create different code.
It uses that system since at least Delphi 3.

Mattias
___
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-12 Thread Marco van de Voort
In our previous episode, Lars said:
> 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.

I think that is the main reason, but that was for the IDE/designers benefit,
not the compiler's. Just like the form names are mentioned in comments in
the .dpr. 

Later the syntax was recycled to tackle file case problems on Kylix.

But the problem is what are relative paths relative too? Project file? The
actual source file?

>  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. 

IMHO these are all shaky uses cases, and actually doing it right is quite
hard.
___
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-12 Thread Mattias Gaertner
On Sun, 12 Feb 2017 16:17:01 +0100 (CET)
mar...@stack.nl (Marco van de Voort) wrote:

>[...]
> >  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.   
> 
> IMHO these are all shaky uses cases, and actually doing it right is quite
> hard.

Why is using -Fu hard?

Mattias
___
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-12 Thread Marco van de Voort
In our previous episode, Mattias Gaertner said:
> > > ../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.   
> > 
> > IMHO these are all shaky uses cases, and actually doing it right is quite
> > hard.
> 
> Why is using -Fu hard?

It requires a project file and Delphi is somewhat shaky with relative paths
which makes configuring it hard. One has the choice between abs paths, the
subset trick, or doubtful relative paths.

(Delphi evaluates relative paths relative to the current directory, which
can be random unless you load it via file->open project)
___
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-12 Thread fredvs
> Why is using -Fu hard? 

Yes, of course it could be a solution but I would prefer something inside
the code.

By the way, IMO, and it  is valable for lot of languages, the way to
define/use the path (of units or libraries or dependencies) is very archaic.
Only LD_LIBRARY_PATH for libraries and for units I do not know if it exist.

For example, fpc can load dynamically libraries but it is not usable if that
libraries depend on other libraries.

It would be great (IMO) if fpc provide, unlike other compilers, some more
modern ways to use  things (units, libraries, etc...) with the appropriate
need-path.

But, once again, it is only a IMO.

Thanks.

Fre;D 



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/uses-myunit-in-src-myunit-pas-tp5727626p5727636.html
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


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

2017-02-12 Thread Sven Barth
On 12.02.2017 19:25, fredvs wrote:
> For example, fpc can load dynamically libraries but it is not usable if that
> libraries depend on other libraries.
> 
> It would be great (IMO) if fpc provide, unlike other compilers, some more
> modern ways to use  things (units, libraries, etc...) with the appropriate
> need-path.
> 
> But, once again, it is only a IMO.

Loading libraries is handled by the OS, not by the compiler or the RTL
and every OS has its own way to deal with dependencies.

Regards,
Sven
___
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-12 Thread fredvs
> Loading libraries is handled by the OS, not by the compiler or the RTL 
> and every OS has its own way to deal with dependencies. 

Yes but the compiler could give some command to the os too...

Of course every OS has its own way to deal with dependencies but that is the
power of fpc, he knows how to speak with those different os.

For example, TProcess also is very os dependent and it uses "environnement"
parameter (that is also very os dependent).

OK for libraries, (even that I think that the compiler could help), but for
units, what about create something that could define path of units used in
use section...

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/uses-myunit-in-src-myunit-pas-tp5727626p5727638.html
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


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

2017-02-12 Thread Michael Van Canneyt



On Sun, 12 Feb 2017, fredvs wrote:


Loading libraries is handled by the OS, not by the compiler or the RTL
and every OS has its own way to deal with dependencies.


Yes but the compiler could give some command to the os too...

Of course every OS has its own way to deal with dependencies but that is the
power of fpc, he knows how to speak with those different os.

For example, TProcess also is very os dependent and it uses "environnement"
parameter (that is also very os dependent).


No it is not. Every OS has an environment ?


OK for libraries, (even that I think that the compiler could help), but for
units, what about create something that could define path of units used in
use section...


You already have such a thing: Lazarus and it's packages.
In FPC, you can use fpmake and fppkg.

But thinking that the compiler itself will automagically determine the path: 
that's simply not realistic.


Michael.
___
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-12 Thread fredvs
> But thinking that the compiler itself will automagically determine the
path: that's simply not realistic. 

Really ?

When the compiler reads uses section and find a "in" like here :

uses myunit in '/thepath/src/myunit.pas'; 

He could do something like:
...
if fpcword = 'in' then begin
IncludeSearchPath((ExtractFilePath('/thepath/src/myunit.pas');
IncludeUnit('/thepath/src/myunit.pas');
...

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/uses-myunit-in-src-myunit-pas-tp5727626p5727640.html
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


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

2017-02-12 Thread fredvs
>> For example, TProcess also is very os dependent and it uses
"environnement" 
>> parameter (that is also very os dependent).

> No it is not. Every OS has an environment ? 

So it is exactly what I propose:

a TLoadLibrary with some features adapted for libraries that TProcess uses
for executables (like environnement).
Of course TLoadLibrary will have a LoadLibrary() and SafeLoadLibrary() but
some properties too.

What do you think ?

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/uses-myunit-in-src-myunit-pas-tp5727626p5727641.html
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


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

2017-02-12 Thread Michael Van Canneyt



On Sun, 12 Feb 2017, fredvs wrote:


For example, TProcess also is very os dependent and it uses

"environnement"

parameter (that is also very os dependent).



No it is not. Every OS has an environment ?


So it is exactly what I propose:

a TLoadLibrary with some features adapted for libraries that TProcess uses
for executables (like environnement).
Of course TLoadLibrary will have a LoadLibrary() and SafeLoadLibrary() but
some properties too.

What do you think ?


I don't see the point at all. 
Why would you copy functionality that the OS provides out of the box ?


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