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

Dmitry Boyarintsev skalogryz.lists at gmail.com
Mon Nov 4 15:36:41 CET 2013


On Mon, Nov 4, 2013 at 9:08 AM, Marcos Douglas <md at delfire.net> wrote:

> 2- If ExtraUtils depends on StrUtils.pas from "lib". But "otherlib" is
> not a subdirectory of lib then the "otherlib needs to be compiled
> using a ALIAS:
> -ALIAS=TheLib at lib\*
>
Ah, yes, you've mentioned the necessity for two steps compilation.
(compile a package first and then compile the program).
Which brings the necessity for external "tools" (similar to make files) or
an IDE must be smart enough to handle them.
(please note "an IDE", thus not refer erring to Lazarus specifically).

But, it might help solving the problem with object names, since a
recompiled package will update object files. hmm.. or not.


> But, for me, doesn't any sense the otherlib does not know the lib's
> sources.
>
Otherlib knows about "lib"s sources - it knows that there should be
"StrUtils" unit.
However, it doesn't know anything about there the "StrUtils" is located, as
well as it doesn't care what to do with other files of the project. It's
compilers job.

In my turn, this is how I'd suggest to compile it:

program\unit1.pas (uses lib/StrUtils.pas)
program\StrUtils.pas
program\unit2.pas (uses program/StrUtils.pas)
lib\StrUtils.pas
otherlib\ExtraUtils.pas (uses lib/StrUtils.pas)
-- 
fpc
-SEARCH program/unit1.pas lib/StrUtils.pas   (point unit1 to use
lib/StrUtils explicitly)
-SEARCH otherlib/ lib/ (point "otherlib" units to use any unit from "lib"
first, if found)
-Fulib
-Fuotherlib
program.pas

That's it, compile everything in one call.

However, the problem with object name conflict (if packages are
precompiled) doesn't allow this to happen.
* using internal linker could help to solve this problem (in that case FPC
could whatever it wants)
* generating object files during the actual compilation could also help
this problem (thus "precompile" will only prepare .ppu files with some kind
of a code, in some kind of form). During the compilation, the code from
.ppu will be transfered to .object files with the names changed to avoid
conflicts.

thanks,
Dmitry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20131104/4c020e8b/attachment.html>


More information about the fpc-pascal mailing list