#1 2016-03-22 23:45:24

Registered: 2015-11-18
Posts: 12

RTTI features provided by mORMot for FPC.

I was searching for some information about extending FPC's RTTI features and I came across mORMot. Now I'm a bit confused: is there any additional RTTI features provided by mormot for FPC?

I'd like to explain what I'd like to do:

- Get property list of Object (for published properties it works fine with typinfo unit; delphi's RTTI allows to work with public properties also, is it possible in FPC; anyway typinfo is okay so far);
- Get (and set) property value by name; (it also works with published properties via typinfo);
- Call method of Object by its name; e.g.:

function CallMethod(Object: TObject; Name: String; Params: array of Variant): Variant; // or something like that


CallMethod(Form1, 'SetBounds', [1, 1, 200, 200]); 

I didn't realize how to do it at all so far. There is MethodAddress, but I cannot understand how to pass arguments to found method dynamically.

If I'm not mistaken It can be done via Delphi's RTTI.Invoke; But what can I use in FPC?
I'm asking here because I found some info about mORMot's implementation of Invoke (e.g. http://forum.lazarus.freepascal.org/ind … c=30678.0)

Can it help me to call methods the way I described before?
Is there additional features in mORMot that I can use to implement some features like ones in Delphi's RTTI unit ?


#2 2016-03-23 07:05:27

From: France
Registered: 2010-06-21
Posts: 14,134

Re: RTTI features provided by mORMot for FPC.

There is no such RTTI available in FPC.
Only the "interface RTTI" branch of FPC add the RTTI for IInvokable interfaces.
But this is not the extended RTTI of Delphi 2010. This is the same RTTI available since Delphi 6.

Then, mORMot is able to invoke such IInvokable interfaces.
But not raw class.


Board footer

Powered by FluxBB