<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Nov 4, 2013 at 10:06 AM, Marcos Douglas <span dir="ltr"><<a href="mailto:md@delfire.net" target="_blank">md@delfire.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">On Mon, Nov 4, 2013 at 11:36 AM, Dmitry Boyarintsev<br>
<<a href="mailto:skalogryz.lists@gmail.com">skalogryz.lists@gmail.com</a>> wrote:<br>
> On Mon, Nov 4, 2013 at 9:08 AM, Marcos Douglas <<a href="mailto:md@delfire.net">md@delfire.net</a>> wrote:<br>
>><br>
>> 2- If ExtraUtils depends on StrUtils.pas from "lib". But "otherlib" is<br>
>> not a subdirectory of lib then the "otherlib needs to be compiled<br>
>> using a ALIAS:<br>
>> -ALIAS=TheLib@lib\*<br>
><br>
> Ah, yes, you've mentioned the necessity for two steps compilation.<br>
> (compile a package first and then compile the program).<br></div></blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="im">
</div>This is not required is optional.<br></blockquote><div>It is required, otherwise a wrong "StrUtils" might be used.<br></div><div>Or let me paraphrase that, it is required to recompile it at least once. <br>
</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im"><br>
> Which brings the necessity for external "tools" (similar to make files) or<br>
> an IDE must be smart enough to handle them.<br>
> (please note "an IDE", thus not refer erring to Lazarus specifically).<br>
<br>
</div>No one compiles programs using line code options. Everybody uses a IDE<br>
or script for do it.<br>
But I did not see what the problem because it is only a new argument<br>
for the compiler.<br></blockquote><div>a scripts or an IDE would need to be adjusted then. It's not a big deal, but it's a change.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">
>> But, for me, doesn't any sense the otherlib does not know the lib's<br>
>> sources.<br>
><br>
> Otherlib knows about "lib"s sources - it knows that there should be<br>
> "StrUtils" unit.<br>
> However, it doesn't know anything about there the "StrUtils" is located, as<br>
> well as it doesn't care what to do with other files of the project. It's<br>
> compilers job.<br>
<br>
</div>I know. When as said "Otherlib do not known about Lib" I was talking<br>
about source paths.<br></blockquote><div>Well a lib, shouldn't care about paths at all, it's compiler's job.<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
If you do not change the unit names, how you can use StrUtils from<br>
Lib, OtherLib and program in a same unit?<br></blockquote><div>You definitely can't. I stated that as a limitation.<br></div><div>That's not a purpose of the tag anyway, the purpose is to resolve uncontrolled unit name collisions (typically introduced by changes into a 3d party lib). <br>
</div><div><br>If you need to mix a code from 2 units that share the same name, you'd need to create a wrapping unit.<br><br></div><div></div><div>---code---<br></div><div>unit LibStrUtils<br><br></div><div>uses StrUtils; <br>
<br></div><div>interface <br><br></div><div>var<br></div><div> procedure DoStrUtil = StrUtils.DoStrUtil;<br>---code---<br></div><div>unit Unit3;<br><br></div><div>uses StrUtils, LibStrUtils;<br><br></div><div>==code==<br>
</div><div><br>program\unit1.pas (uses lib/StrUtils.pas)<br>program\StrUtils.pas<br>program\unit2.pas (uses program/StrUtils.pas)<br>program\unit3.pas (uses program/StrUtils.pas)<br>program\LibStrUtils.pas (uses lib/StrUtils.pas)<br>
lib\StrUtils.pas <br>
otherlib\ExtraUtils.pas (uses lib/StrUtils.pas)<br>-- <br><div class="gmail_extra">fpc<br></div><div class="gmail_extra">-SEARCH program/unit1.pas lib/StrUtils.pas (point unit1 to use lib/StrUtils explicitly) <br>-SEARCH program/LibStrUtils.pas lib/StrUtils.pas (point unit1 to use lib/StrUtils explicitly) <br>
</div><div class="gmail_extra">-SEARCH otherlib/ lib/ (point "otherlib" units to use any unit from "lib" first, if found)<br></div><div class="gmail_extra">-Fulib<br></div><div class="gmail_extra">-Fuotherlib<br>
</div>program.pas<br><br></div><div><br>thanks,<br>Dmitry<br></div></div></div></div>