[fpc-pascal] Re: [Bulk] Re: Namespaces Support

Marcos Douglas md at delfire.net
Sat Nov 2 23:14:08 CET 2013


On Sat, Nov 2, 2013 at 7:44 PM, Dmitry Boyarintsev
<skalogryz.lists at gmail.com> wrote:
> On Sat, Nov 2, 2013 at 12:19 PM, Marcos Douglas <md at delfire.net> wrote:
>>
>> > compiling with
>> > fpc -ALIAS /lib/* TheLib
>> >
>> > won't help, unless you change "ExtraUtils.pas" to use TheLib.StrUtils
>>
>> Well, is more common to use just ppu files to not compile these files
>> every compilation. So, the Lib was already compiled using your own
>> files, all in the same directory or tree.
>
> The linker has to choose only 1 object file and the wrong file will be taken
> from the program folder.

I don't know much about linker. If you saying that need to be like that, ok.

>> > My proposal looks like this:
>> > -SEARCH
>> >
>> > fpc -SEARCH/program/unit1.pas@/lib/
>> >
>> > Causing fpc to look for units at "Libs" first when compiling
>> > "/program/unit1.pas"
>> > No changes in any source code necessary.
>> > With the swicth present
>> > ---code---
>> > unit unit1
>> >
>> > uses StrUtils; // strutils from lib
>> > ===code===
>> >
>> > thanks,
>> > Dmitry
>>
>> This works only if you don't want use StrUtils of your project and,
>> IMHO, this is more complex solution. You will need to tell the
>> compiler which unit of your project that compiles using an unit in
>> another place that uses the same unit name you already uses in your
>> project
>
> Wrong. The search exception is created for a certain file or files under a
> certain directory
> In example above, only /program/unit1.pas would be using StrUtils from "lib"
> any other file would be using StrUtils from "program".

So, I can't use Lib's StrUtils and Program's StrUtils in a third unit
(unit1)? Doesn't make sense.


Your thoughts about my mail prior (last part)?

Regards,
Marcos Douglas



More information about the fpc-pascal mailing list