You are not logged in.
Pages: 1
Hi ab,
I use RTTI for my classes. I experience following case as explained here:
http://stackoverflow.com/questions/9499 … attributes
This is when I include mORMot SynCommons and SQLite3Commons in my uses before I try to access TRttiType's GetProperties method. Other RTTI information is also kind of broken.
If I use to build the whole project, run, AV raise at System.rtti ConstructAttributes, sub function FindCtor at line imp := PPPointer(p)^^; It seems p (CtorAddr) is not a valid pointer.
If I modify only my unit, recompile (not rebuild), already build dcus used (along with mORMot dcus).
In second case FindCtor() function exits on very begining:
for Result in AttrType.GetMethods do
if Result.CodeAddress = CtorAddr then
Exit;
If seems now we have valid CtorAddr, no AV, result as expected.
I use Delphi XE2 Upd1. The author of the stackoverflow.com used Delphi XE. Do you have any clue why this happens? Googling does point me at any solutions. Can this problem be related to mORMot RTTI hacks?
Thanks.
Last edited by chapa (2012-06-28 10:48:59)
Offline
SQLite3Commons RTTI functions does not hack the RTTI, just use the vmtAutoTable VMT slot.
You are probably mixing types of SQLite3Commons and TypeInfo units.
Some types have the same exact name in both units.
So be aware to name the exact needed unit last in your uses clause.
I do not know what to say else, without any code to reproduce.
Offline
In Synopse.inc you have following:
{$RTTI EXPLICIT METHODS([]) PROPERTIES([]) FIELDS([])}
But for my purposes I need following directive:
{$RTTI INHERIT METHODS([vcPublic]) PROPERTIES([vcPublic]) FIELDS([vcPublic])}
If I define it in my class declaration unit seems to work so far.
It may worth to know, that your code change the default behavior of compilator regarding RTTI generation and if anyone starts using mORMot units in existing project, default RTTI behavior may be broken. Like my case
Anyway, sorry for bothering you, hope it may help others too.
Last edited by chapa (2012-06-28 11:13:09)
Offline
You are right!
Those settings have a local scope, so it would affect only class definitions within the units containing {$I Synopse.inc}, right?
Or perhaps it also affects sub-classes.
Worth putting some reference here, in all cases!
Thanks for the feedback.
Offline
Pages: 1