Sorry for confusion, my email wasn't clear... <div>old fpc version, that I have to use because of availability of various units...Free Pascal Compiler version 2.2.2 [2008/08/03] for i386<div><div><div><br></div></div><div>
this is jim.pp---</div><div><div>unit jim;</div><div>interface</div><div> function fna:string;</div><div> function fnb:string;</div><div><br></div><div>implementation</div><div>function fna:string;</div><div>begin</div><div>
 fna:='jim';</div><div>end;</div><div>function fnb:string;</div><div>begin</div><div> fnb:=fna;</div><div>end;</div><div>end.</div></div><div><br></div></div><div>this is fred.pp---</div><div><div>uses jim;</div><div>
<br></div><div>function fna:string;</div><div>begin</div><div> fna:='fred';</div><div>end;</div><div><br></div><div>begin</div><div> writeln(fnb);</div><div>end.</div></div><div><br></div><div>This writeln gives jim, ie the version in jim - I'd like it to be fred & thought that it would! What can I do please, to _force_ fnb to use the fred version of fna?</div>
<div><br></div><div>John</div><div><br></div><div><div class="gmail_quote">On 18 November 2011 16:04, Sven Barth <span dir="ltr"><<a href="mailto:pascaldragon@googlemail.com">pascaldragon@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">Am 18.11.2011 16:49, schrieb John Lee:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a normal fpc unit, call it jim, with 2 functions fna & fnb . fnb<div><div class="h5"><br>
uses internally fna.<br>
<br>
My main program, has a uses clause including jim, and also a _different_<br>
version of fna, with same parameters as for that in jim, but no fnb.<br>
<br>
The problem I get is that when, in main program fnb doesn't use the<br>
_new_ version in the main program of fna but still uses the version that<br>
is in the unit. I'd thought that versions of fns in the main program are<br>
used in place of those in the unit when they both have the same name,<br>
but maybe not when a function is used another function?<br>
<br>
Never seen this before - is there a way I can force fnb to use the main<br>
program's version of fna, not the version that's in the unit?<br>
</div></div></blockquote>
<br>
Now I that I reread your mail I might get what is going on.<br>
<br>
You expect "fnb" which is declared in "jim" to use the function "fna" declared in the main program? If so, then this isn't possible. The unit "jim" is already compiled, thus the call from "fnb" to "jim.fna" is fixed. Your only possibilty would be to use function/procedure variables and pass the function to call as a parameter to "fnb".<div class="HOEnZb">
<div class="h5"><br>
<br>
Regards,<br>
Sven<br>
<br>
______________________________<u></u>_________________<br>
fpc-pascal maillist  -  <a href="mailto:fpc-pascal@lists.freepascal.org" target="_blank">fpc-pascal@lists.freepascal.<u></u>org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/<u></u>mailman/listinfo/fpc-pascal</a><br>
</div></div></blockquote></div><br></div></div>