(but it will only work if all others are also marked overload;)
If only one unit has the "overload" directive, sequence in "uses" section is important. Compiler starts search from units which were mentioned last and if it finds a header with mismatching parameters and "overload", it continues a search. Otherwise not.
Indeed, as soon as it finds an overloaded version without the "overload" modifier it stops searching for more and considers that the "last" version, which can be easily ascertained with a simple test with at least three units, an overload per unit and only one of them having the
overload modifier:
{ In the first unit ...}
function DoSomething(Value: Double): String;
begin
Result := 'As Double: ' + FloatToStr(Value);
end;
{ In the second unit ...}
function DoSomething(Value: Integer): String;
begin
Result := 'As Integer: ' + IntToStr(Value);
end;
{ In the third one ...}
function DoSomething(Value: String): String; overload;
begin
Result := 'As String: ' + AnsiProperCase(Value, StdWordDelims);
end;
For example, writing:
uses first, second, third;
you can't call
DoSomething(367.25); writing
uses second, first, third;
and calling
DoSomething(321) will convert the integer and use the "Double" overload.
So Marco was quite right and all the overloads (except the very first) should be declared with the
overload modifier, as the docs (if somewhat cryptically) say.