View Issue Details

IDProjectCategoryView StatusLast Update
0037539pas2jsrtlpublic2020-08-14 12:21
Reporterhenrique Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformSystemOSWindows 
Fixed in Versiontrunk 
Summary0037539: The HRESULT
DescriptionI declared the HRESULT type in the System, for compatibility with Delphi in the functions of the IInterface interface.
TagsNo tags attached.
Fixed in Revision820
Attached Files

Relationships

related to 0037543 resolvedMichael Van Canneyt Implementation of HRESULT 

Activities

henrique

2020-08-10 19:55

reporter  

System.patch (2,429 bytes)   
From 91a3dddbadb414f9bb69c4d7c1a7c2528ee74458 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Mon, 10 Aug 2020 14:03:32 -0300
Subject: [PATCH] Declarado o HResult.

---
 packages/rtl/classes.pas | 12 ++++++------
 packages/rtl/system.pas  |  2 ++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/packages/rtl/classes.pas b/packages/rtl/classes.pas
index e99337d..3d70e08 100644
--- a/packages/rtl/classes.pas
+++ b/packages/rtl/classes.pas
@@ -216,10 +216,10 @@ type
   private
     FOwnerInterface: IInterface;
   protected
-    function _AddRef: Integer;
-    function _Release: Integer;
+    function _AddRef: HResult;{$IFDEF DCC}stdcall;{$ENDIF}
+    function _Release: HResult;{$IFDEF DCC}stdcall;{$ENDIF}
   public
-    function QueryInterface(const IID: TGUID; out Obj): integer; virtual;
+    function QueryInterface(const IID: TGUID; out Obj): HResult; virtual;{$IFDEF DCC}stdcall;{$ENDIF}
     procedure AfterConstruction; override;
   end;
 
@@ -591,15 +591,15 @@ type
     procedure ValidateContainer(AComponent: TComponent); virtual;
     procedure ValidateInsert(AComponent: TComponent); virtual;
   protected
-    function _AddRef: Integer;
-    function _Release: Integer;
+    function _AddRef: HResult;{$IFDEF DCC}stdcall;{$ENDIF}
+    function _Release: HResult;{$IFDEF DCC}stdcall;{$ENDIF}
   public
     constructor Create(AOwner: TComponent); virtual; reintroduce;
     destructor Destroy; override;
     procedure BeforeDestruction; override;
     procedure DestroyComponents;
     procedure Destroying;
-    function QueryInterface(const IID: TGUID; out Obj): integer; virtual;
+    function QueryInterface(const IID: TGUID; out Obj): HResult; virtual;{$IFDEF DCC}stdcall;{$ENDIF}
     procedure WriteState(Writer: TWriter); virtual;
 //    function ExecuteAction(Action: TBasicAction): Boolean; virtual;
     function FindComponent(const AName: string): TComponent;
diff --git a/packages/rtl/system.pas b/packages/rtl/system.pas
index f8376af..edf55c1 100644
--- a/packages/rtl/system.pas
+++ b/packages/rtl/system.pas
@@ -91,6 +91,8 @@ type
 
   TDynArrayIndex = NativeInt;
   TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
+  
+  HRESULT = Integer;
 
   TCompareOption = ({coLingIgnoreCase, coLingIgnoreDiacritic, }coIgnoreCase{,
                     coIgnoreKanaType, coIgnoreNonSpace, coIgnoreSymbols, coIgnoreWidth,
-- 
2.28.0.windows.1

System.patch (2,429 bytes)   

henrique

2020-08-10 21:32

reporter   ~0124743

Last edited: 2020-08-10 21:33

View 2 revisions

Apply this patch, ignore the another.
System-2.patch (1,738 bytes)   
From 43d31890519bf25e011f47bf9f848ff1ddcf2556 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Mon, 10 Aug 2020 16:31:11 -0300
Subject: [PATCH] Declarado o HResult.

---
 packages/rtl/classes.pas | 4 ++--
 packages/rtl/system.pas  | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/packages/rtl/classes.pas b/packages/rtl/classes.pas
index e99337d..d1dd67d 100644
--- a/packages/rtl/classes.pas
+++ b/packages/rtl/classes.pas
@@ -219,7 +219,7 @@ type
     function _AddRef: Integer;
     function _Release: Integer;
   public
-    function QueryInterface(const IID: TGUID; out Obj): integer; virtual;
+    function QueryInterface(const IID: TGUID; out Obj): HRESULT; virtual;
     procedure AfterConstruction; override;
   end;
 
@@ -599,7 +599,7 @@ type
     procedure BeforeDestruction; override;
     procedure DestroyComponents;
     procedure Destroying;
-    function QueryInterface(const IID: TGUID; out Obj): integer; virtual;
+    function QueryInterface(const IID: TGUID; out Obj): HRESULT; virtual;
     procedure WriteState(Writer: TWriter); virtual;
 //    function ExecuteAction(Action: TBasicAction): Boolean; virtual;
     function FindComponent(const AName: string): TComponent;
diff --git a/packages/rtl/system.pas b/packages/rtl/system.pas
index f8376af..edf55c1 100644
--- a/packages/rtl/system.pas
+++ b/packages/rtl/system.pas
@@ -91,6 +91,8 @@ type
 
   TDynArrayIndex = NativeInt;
   TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
+  
+  HRESULT = Integer;
 
   TCompareOption = ({coLingIgnoreCase, coLingIgnoreDiacritic, }coIgnoreCase{,
                     coIgnoreKanaType, coIgnoreNonSpace, coIgnoreSymbols, coIgnoreWidth,
-- 
2.28.0.windows.1

System-2.patch (1,738 bytes)   

Michael Van Canneyt

2020-08-11 13:28

administrator   ~0124753

Resolved, but added the HRESULT to types.pas.
This is why we append jsdelphisystem to the uses clause of the generated unit: there you can add additional types.

henrique

2020-08-11 13:42

reporter   ~0124757

I put it in system, because in Delphi this statement is there. If you put in the types, it will probably give problem. I'm compiling everything here and I'll report if you give a problem.

henrique

2020-08-13 20:18

reporter   ~0124853

I finally managed to test this and it was a problem with Delphi. This is because HRESULT is in System, in Delphi, and because there is an HRESULT in "Types", there is an error of "E1008 Integer and HRESULT interchanged". You would have to put HRESULT on the System. Could this be a problem?

henrique

2020-08-13 20:18

reporter   ~0124854

System-3.patch (1,111 bytes)   
From a62cc73b99f4d557204039f9b6538106972104a7 Mon Sep 17 00:00:00 2001
From: Henrique Gottardi Werlang <henriquewerlang@hotmail.com>
Date: Thu, 13 Aug 2020 15:17:36 -0300
Subject: [PATCH] Mudado o HRESULT de unit.

---
 packages/rtl/system.pas | 2 ++
 packages/rtl/types.pas  | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/packages/rtl/system.pas b/packages/rtl/system.pas
index f8376af..2a6acf0 100644
--- a/packages/rtl/system.pas
+++ b/packages/rtl/system.pas
@@ -89,6 +89,8 @@ type
   WideChar = char;
   UnicodeChar = char;
 
+  HRESULT = Integer;
+
   TDynArrayIndex = NativeInt;
   TTextLineBreakStyle = (tlbsLF,tlbsCRLF,tlbsCR);
 
diff --git a/packages/rtl/types.pas b/packages/rtl/types.pas
index ceabf18..6b9bb11 100644
--- a/packages/rtl/types.pas
+++ b/packages/rtl/types.pas
@@ -45,8 +45,6 @@ type
     Left, Top, Right, Bottom: Integer;
   end;
   
-  HRESULT = Integer;
-
 function EqualRect(const r1,r2 : TRect) : Boolean;
 function Rect(Left, Top, Right, Bottom : Integer) : TRect;
 function Bounds(ALeft, ATop, AWidth, AHeight : Integer) : TRect;
-- 
2.28.0.windows.1

System-3.patch (1,111 bytes)   

Michael Van Canneyt

2020-08-14 12:21

administrator   ~0124877

Moved to system unit.

Issue History

Date Modified Username Field Change
2020-08-10 19:55 henrique New Issue
2020-08-10 19:55 henrique File Added: System.patch
2020-08-10 21:32 henrique Note Added: 0124743
2020-08-10 21:32 henrique File Added: System-2.patch
2020-08-10 21:33 henrique Note Edited: 0124743 View Revisions
2020-08-11 07:56 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-08-11 07:56 Michael Van Canneyt Status new => assigned
2020-08-11 13:28 Michael Van Canneyt Status assigned => resolved
2020-08-11 13:28 Michael Van Canneyt Resolution open => fixed
2020-08-11 13:28 Michael Van Canneyt Fixed in Version => trunk
2020-08-11 13:28 Michael Van Canneyt Fixed in Revision => 820
2020-08-11 13:28 Michael Van Canneyt Note Added: 0124753
2020-08-11 13:42 henrique Note Added: 0124757
2020-08-11 15:23 Michael Van Canneyt Relationship added related to 0037543
2020-08-13 20:18 henrique Status resolved => feedback
2020-08-13 20:18 henrique Resolution fixed => open
2020-08-13 20:18 henrique Note Added: 0124853
2020-08-13 20:18 henrique Note Added: 0124854
2020-08-13 20:18 henrique File Added: System-3.patch
2020-08-13 20:18 henrique Status feedback => assigned
2020-08-14 12:21 Michael Van Canneyt Status assigned => resolved
2020-08-14 12:21 Michael Van Canneyt Resolution open => fixed
2020-08-14 12:21 Michael Van Canneyt Note Added: 0124877