[fpc-devel] Namespaces like URLs

Martin fpc at mfriebe.de
Tue Jul 27 02:08:25 CEST 2010


On 26/07/2010 23:08, Graeme Geldenhuys wrote:
> 2010/7/27 Adem :
>    
>> I wouldn't have much of an issue with something like
>>
>> uses
>>   zip IN '/units/my/zip.pas' AS myzip;
>>   zip IN '/units/lib/zip/zip.pas' AS ziplib;
>>      
>
> And if you have multiple developers working on the same project and
> their source code directory hierarchy is not exactly the same as yours
> (shown above), then that project would not compile on there systems.
> You cannot hard-code such paths inside a unit and have any hope that
> it will be "portable" between developers and OSes (\ vs / delimiters).
>    

Thats why,. if you read the following thread:
http://lists.freepascal.org/lists/fpc-devel/2010-July/021088.html

you will see that there is a better solution

For each package, you must specify a search path (commandine or fpc.cfg) 
-Fu=path

Extend it do declare an alias for the path (which then is your namespace

-Fu=SynEdit::/path/to/symedit


uses Utils in ':SynEdit' alias SynUtils



More information about the fpc-devel mailing list