|
@@ -280,7 +280,7 @@ begin
|
|
Result := @ffi_type_pointer;
|
|
Result := @ffi_type_pointer;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function ValueToFFIValue(constref aValue: Pointer; aKind: TTypeKind; aFlags: TParamFlags; aIsResult: Boolean): Pointer;
|
|
|
|
|
|
+function ArgIsIndirect(aKind: TTypeKind; aFlags: TParamFlags; aIsResult: Boolean): Boolean;
|
|
const
|
|
const
|
|
ResultTypeNeedsIndirection = [
|
|
ResultTypeNeedsIndirection = [
|
|
tkAString,
|
|
tkAString,
|
|
@@ -290,12 +290,20 @@ const
|
|
tkDynArray
|
|
tkDynArray
|
|
];
|
|
];
|
|
begin
|
|
begin
|
|
- Result := aValue;
|
|
|
|
|
|
+ Result := False;
|
|
if (aKind = tkSString) or
|
|
if (aKind = tkSString) or
|
|
(aIsResult and (aKind in ResultTypeNeedsIndirection)) or
|
|
(aIsResult and (aKind in ResultTypeNeedsIndirection)) or
|
|
(aFlags * [pfArray, pfOut, pfVar, pfConstRef] <> []) or
|
|
(aFlags * [pfArray, pfOut, pfVar, pfConstRef] <> []) or
|
|
((aKind = tkUnknown) and (pfConst in aFlags)) then
|
|
((aKind = tkUnknown) and (pfConst in aFlags)) then
|
|
- Result := @aValue;
|
|
|
|
|
|
+ Result := True;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function ValueToFFIValue(constref aValue: Pointer; aKind: TTypeKind; aFlags: TParamFlags; aIsResult: Boolean): Pointer;
|
|
|
|
+begin
|
|
|
|
+ if ArgIsIndirect(aKind, aFlags, aIsResult) then
|
|
|
|
+ Result := @aValue
|
|
|
|
+ else
|
|
|
|
+ Result := aValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure FFIValueToValue(Source, Dest: Pointer; TypeInfo: PTypeInfo);
|
|
procedure FFIValueToValue(Source, Dest: Pointer; TypeInfo: PTypeInfo);
|