Sorry for confusion, my email wasn't clear... 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
this is jim.pp--- unit jim; interface function fna:string; function fnb:string; implementation function fna:string; begin fna:='jim'; end; function fnb:string; begin fnb:=fna; end; end. this is fred.pp--- uses jim; function fna:string; begin fna:='fred'; end; begin writeln(fnb); end. 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? John On 18 November 2011 16:04, Sven Barth <pascaldra...@googlemail.com> wrote: > Am 18.11.2011 16:49, schrieb John Lee: > >> I have a normal fpc unit, call it jim, with 2 functions fna & fnb . fnb >> >> uses internally fna. >> >> My main program, has a uses clause including jim, and also a _different_ >> version of fna, with same parameters as for that in jim, but no fnb. >> >> The problem I get is that when, in main program fnb doesn't use the >> _new_ version in the main program of fna but still uses the version that >> is in the unit. I'd thought that versions of fns in the main program are >> used in place of those in the unit when they both have the same name, >> but maybe not when a function is used another function? >> >> Never seen this before - is there a way I can force fnb to use the main >> program's version of fna, not the version that's in the unit? >> > > Now I that I reread your mail I might get what is going on. > > 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". > > > Regards, > Sven > > ______________________________**_________________ > fpc-pascal maillist - > fpc-pascal@lists.freepascal.**org<fpc-pascal@lists.freepascal.org> > http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal> >
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal