[fpc-pascal] Free Pascal Directories

Jonas Maebe jonas.maebe at elis.ugent.be
Thu Oct 2 23:34:36 CEST 2014


On 02/10/14 23:23, silvioprog wrote:
> On Thu, Oct 2, 2014 at 6:13 PM, Jonas Maebe <jonas.maebe at elis.ugent.be
> <mailto:jonas.maebe at elis.ugent.be>> wrote:
>
>     "Note that this switch does not propagate to other units, i.e. it’s
>     scope is limited to the current unit."
>
>     "unit" should be interpreted as "compilation unit" in this context.
>
> Correct. But it does not work fine if the path contains two or more
> units. E.g:
>
> {$unitpath path\to\the\all\units\of\the\synapse40\source\lib}
>
> "..\..\3rdparty\synapse40\source\lib\httpsend.pas(72,3) Fatal: Can't
> find unit blcksock used by httpsend."

That's because httpsend is a different unit than the one that included 
the {$unitpath ...} directive. Once you are inside the httpsend unit, 
the directive is no longer valid, as the documentation explains. And 
hence, other units in that same directory won't be found.

I understand that this may be counter-intuitive, but it's how the 
feature was designed and how it is documented. I think the directive is 
completely local to a single compilation unit because, presumably, it 
was originally intended to allow for having units in "packages" to 
contain their own unitpath directives without polluting the unit search 
path of the main program.

> I tried too {$unitpath path\to\the\all\units\of\the\synapse40\source\lib\*}:
>
> "Can not find unit httpsend used by myunit."

Of course that won't work: it will add all directories under 
"...\synapse40\source\lib" to the unit search path, but not 
"...\synapse40\source\lib" itself (which is where your httpsend unit is 
located).


Jonas




More information about the fpc-pascal mailing list