Browse Source

* fix passing structured result values on non-Win32

git-svn-id: trunk@41548 -
svenbarth 6 years ago
parent
commit
033561d039
1 changed files with 10 additions and 0 deletions
  1. 10 0
      packages/rtl-objpas/src/i386/invoke.inc

+ 10 - 0
packages/rtl-objpas/src/i386/invoke.inc

@@ -21,6 +21,8 @@ function ReturnResultInParam(aType: PTypeInfo): Boolean;
 var
 var
   td: PTypeData;
   td: PTypeData;
 begin
 begin
+  { Only on Win32 structured types of sizes 1, 2 and 4 are returned directly
+    instead of a result parameter }
   Result := False;
   Result := False;
   if Assigned(aType) then begin
   if Assigned(aType) then begin
     case aType^.Kind of
     case aType^.Kind of
@@ -33,12 +35,20 @@ begin
       tkDynArray:
       tkDynArray:
         Result := True;
         Result := True;
       tkArray: begin
       tkArray: begin
+{$ifdef win32}
         td := GetTypeData(aType);
         td := GetTypeData(aType);
         Result := not (td^.ArrayData.Size in [1, 2, 4]);
         Result := not (td^.ArrayData.Size in [1, 2, 4]);
+{$else}
+        Result := True;
+{$endif}
       end;
       end;
       tkRecord: begin
       tkRecord: begin
+{$ifdef win32}
         td := GetTypeData(aType);
         td := GetTypeData(aType);
         Result := not (td^.RecSize in [1, 2, 4]);
         Result := not (td^.RecSize in [1, 2, 4]);
+{$else}
+        Result := True;
+{$endif}
       end;
       end;
       tkSet: begin
       tkSet: begin
         td := GetTypeData(aType);
         td := GetTypeData(aType);