RTL custom interface types as records

This commit is contained in:
Michael Schimmel
2025-12-11 14:22:09 +01:00
parent 3ed5a4011f
commit 18dde168fd
13 changed files with 918 additions and 84 deletions
+21 -1
View File
@@ -84,6 +84,7 @@ type
TNativeFunc_OF_O = function(A: Int64; B: Double): Int64;
TNativeFunc_FO_F = function(A: Double; B: Int64): Double;
TNativeFunc_FO_O = function(A: Double; B: Int64): Int64;
TNativeFunc_TT_T = function(const A: String; const B: String): String;
private
class var
@@ -105,6 +106,7 @@ type
class function CreateWrapper_OF_O(CodeAddress: Pointer): TDataValue.TFunc; static;
class function CreateWrapper_FO_F(CodeAddress: Pointer): TDataValue.TFunc; static;
class function CreateWrapper_FO_O(CodeAddress: Pointer): TDataValue.TFunc; static;
class function CreateWrapper_TT_T(CodeAddress: Pointer): TDataValue.TFunc; static;
class function CreateStaticWrapper(
method: TRttiMethod;
retType: IStaticType;
@@ -656,6 +658,20 @@ begin
end;
end;
class function TRtlRegistry.CreateWrapper_TT_T(CodeAddress: Pointer): TDataValue.TFunc;
begin
Result :=
function(const Args: TArray<TDataValue>): TDataValue
var
A: String;
B: String;
begin
A := Args[0].AsText;
B := Args[1].AsText;
Result := TNativeFunc_TT_T(CodeAddress)(A, B);
end;
end;
class function TRtlRegistry.CreateStaticWrapper(
method: TRttiMethod;
retType: IStaticType;
@@ -736,7 +752,11 @@ begin
begin
// Keywords are passed as Int64 (index)
Result := CreateWrapper_OO_O(ptr); // e.g. Equal_Keyword_Keyword
end;
end
else if (k1 = stText) and (k2 = stText) then
begin
Result := CreateWrapper_TT_T(ptr); // e.g. String concat
end
end;
end;