Skip to content

Error Undefined symbol .La?????? when using inlined generic methods from different unit

Original Reporter info from Mantis: dmz73 @dmz73
  • Reporter name:

Description:

Using inlined generic functions from different unit causes error undefined symbol: .La?????

Steps to reproduce:

Create simple program:

program Project1;
{$mode delphi}
uses unit1;
var R: TRec;
begin
  R.GetArr<single>;
end.

Add unit1:
unit Unit1;
{$mode Delphi}
interface
type
  TRec = record
    C: TArray<single>;
    function GetArr<T>: TArray<T>; inline;
  end;
implementation
function TRec.GetArr<T>: TArray<T>;
begin
  result := nil;
  case GetTypeKind(T) of
    tkFloat:
      if SizeOf(T) = SizeOf(Single) then result := C;
  end;
end;
end.

Compile the program and following error is reported:
Error: Undefined symbol: .La17 (first seen in project1.o)

If all code is in the same unit then compile is successful.
program Project1;
{$mode delphi}
//uses unit1;
type
  TRec = record
    C: TArray<single>;
    function GetArr<T>: TArray<T>; inline;
  end;
  function TRec.GetArr<T>: TArray<T>;
  begin
    result := nil;
    case GetTypeKind(T) of
      tkFloat:
        if SizeOf(T) = SizeOf(Single) then result := C;
    end;
  end;
var R: TRec;
begin
  R.GetArr<single>;
end.

Mantis conversion info:

  • Mantis ID: 38827
  • OS: Windows
  • OS Build: 10
  • Platform: Win64
  • Version: 3.3.1
  • Monitored by: » @MageSlayer (Denis Golovan)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information