View Issue Details

IDProjectCategoryView StatusLast Update
0034611FPCRTLpublic2018-11-30 04:43
Reportersilvioprog Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version3.3.1 
Target Version3.2.0Fixed in Version3.3.1 
Summary0034611: [PATCH] rtti: allows to get the size of an argument type
DescriptionHi.

Patch in attachment.

Thank you!
TagsNo tags attached.
Fixed in Revision40394
FPCOldBugId
FPCTarget
Attached Files

Activities

silvioprog

2018-11-27 18:56

reporter  

0001-rtti-allows-to-get-the-size-of-an-argument-type.-pat.patch (1,279 bytes)   
From 8975deae642cb1b206a6aa3ca7744566f4d2e008 Mon Sep 17 00:00:00 2001
From: silvioprog <silvioprog@gmail.com>
Date: Tue, 27 Nov 2018 15:50:06 -0300
Subject: [PATCH 1/1] rtti: allows to get the size of an argument type. (patch
 by silvioprog)

---
 packages/rtl-objpas/src/inc/rtti.pp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/packages/rtl-objpas/src/inc/rtti.pp b/packages/rtl-objpas/src/inc/rtti.pp
index 109acfd021..c9de64a999 100644
--- a/packages/rtl-objpas/src/inc/rtti.pp
+++ b/packages/rtl-objpas/src/inc/rtti.pp
@@ -437,6 +437,7 @@ type
 
   TFunctionCallParameter = record
     ValueRef: Pointer;
+    ValueSize: SizeInt;
     Info: TFunctionCallParameterInfo;
   end;
   TFunctionCallParameterArray = specialize TArray<TFunctionCallParameter>;
@@ -812,6 +813,7 @@ begin
   SetLength(funcargs, Length(aArgs));
   for i := Low(aArgs) to High(aArgs) do begin
     funcargs[i - Low(aArgs) + Low(funcargs)].ValueRef := aArgs[i].GetReferenceToRawData;
+    funcargs[i - Low(aArgs) + Low(funcargs)].ValueSize := aArgs[i].DataSize;
     funcargs[i - Low(aArgs) + Low(funcargs)].Info.ParamType := aArgs[i].TypeInfo;
     funcargs[i - Low(aArgs) + Low(funcargs)].Info.ParamFlags := [];
     funcargs[i - Low(aArgs) + Low(funcargs)].Info.ParaLocs := Nil;
-- 
2.17.1

Thaddy de Koning

2018-11-28 12:53

reporter   ~0112245

You don't need rtti for the size of... We already have SizeOf() which always give the size known at compile time.

silvioprog

2018-11-28 13:00

reporter   ~0112246

RTTI = Runtime Type Information. This patch is precisely to retrieve a size in runtime.

Michael Van Canneyt

2018-11-29 15:34

administrator   ~0112262

Checked & applied, thank you for the patch !

silvioprog

2018-11-30 04:43

reporter   ~0112271

Great! I'm using it in the following code (that will be sent as patch soon):

https://github.com/silvioprog/rtti.invoke/blob/master/invoke_unix64.inc#L225

Thanks a lot for applying it! :-)

Issue History

Date Modified Username Field Change
2018-11-27 18:56 silvioprog New Issue
2018-11-27 18:56 silvioprog File Added: 0001-rtti-allows-to-get-the-size-of-an-argument-type.-pat.patch
2018-11-28 12:53 Thaddy de Koning Note Added: 0112245
2018-11-28 13:00 silvioprog Note Added: 0112246
2018-11-29 15:34 Michael Van Canneyt Fixed in Revision => 40394
2018-11-29 15:34 Michael Van Canneyt Note Added: 0112262
2018-11-29 15:34 Michael Van Canneyt Status new => resolved
2018-11-29 15:34 Michael Van Canneyt Fixed in Version => 3.3.1
2018-11-29 15:34 Michael Van Canneyt Resolution open => fixed
2018-11-29 15:34 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-11-29 15:34 Michael Van Canneyt Target Version => 3.2.0
2018-11-30 04:43 silvioprog Note Added: 0112271
2018-11-30 04:43 silvioprog Status resolved => closed