- Next compilation attempt: "Duplicate identifier "Disc"" in unit DiscImage. OK, there is a property Disc with the same name as this local variable; mode ObjFPC does not accept this. To fix this and all other issues of this kind I opened the project options > "Compiler options" > "Parsing" and selected "Delphi (-MDelphi)" in the "Syntax mode" combo box.
In my process to migrate it away from being MDelphi, I found the same error. Initially I changed the identifier name to "Disk", before I realised I had been stupid originally and could have just used "Result", and remove the identifier declaration completely.
In such cases I normally put a lower-case L in front of the local identifier ('l" = "local"). And this removes the ambiguity.
TDirectory is defined in the DiscImage unit. It is my own definition.
I used the DiscImage unit from your website, it does not contain a TDirectory.
Another oddity (and I know this is going off topic) I've found is with the function:
function TMainForm.IntToStrComma(size: Int64): String;
begin
Result:=Format('%.0n',[Real(size)]);
end;
With {$MODE MDelphi} it returns 0, no matter what 'size' is set to (bearing in mind this works on Delphi). But change to {$MODE objFPC} and it works fine - returns a number (as a string) with thousands separators.
I don't know, but I almost never use the old "real" type which confuses me with Turbo Pascal. Maybe it does not work when "real" requires less bytes than Int64. I would simply multiply Size by 1.0 - this works always, for sure:
Result := Format('%.0n', [1.0*size]);