[fpc-pascal] using functions from units & main programme

Sven Barth pascaldragon at googlemail.com
Fri Nov 18 16:59:13 CET 2011


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?

Without example code its hard do decide what the problem is.

Pausible causes:
* there are different parameters (maybe caused by a different $mode or 
some option), thus the compiler tries to call the best fitting function 
for the given parameters
* if the function in the program is declared below its point of calling 
then the function from "jim" will be used
* a bug in the compiler

Can you please state compiler version and platform (just so that the 
information is available)?

Regards,
Sven




More information about the fpc-pascal mailing list