[fpc-pascal] Free Pascal Directories

silvioprog silvioprog at gmail.com
Thu Oct 2 23:40:01 CEST 2014


On Thu, Oct 2, 2014 at 6:34 PM, Jonas Maebe <jonas.maebe at elis.ugent.be>
wrote:

> 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


Hm... now it is clear to me. Thanks!

But it would be an nice feature in Free Pascal, something like the "import"
of Python and Java. =)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20141002/7ef0535c/attachment.html>


More information about the fpc-pascal mailing list