Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-05

Invoking methods through rtti

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys
to Mazo Winst
Mazo Winst wrote
Is there any way to invoke a method passing parameters through rtti?

Yes, it should be possible. Take a look at the FPCUnit (unit testing framework) included with FPC. The testing framework invokes methods and passes parameters around.

Regards,
Graeme

Reply by email

Mazo Winst
to Sven Barth
Sven Barth wrote 5 lines
Am 09.05.2016 17:23 schrieb "Mazo Winst" : > > Is there any way to invoke a method passing parameters through rtti? As long as you know the signature of the method you can cast the pointer

to the method to an approbiate method variable and call that. For dynamic calls you'll need to wait for Invoke() support which is on the ToDo list, but there's no ETA yet.

In my use case,the name of the method are regards

Reply by email

Mazo Winst
to Graeme Geldenhuys: Yes, it should be possible. Take a look at the FPCUnit (unit testing framework) included…

Em segunda-feira, 9 de maio de 2016, Graeme Geldenhuys <

Show quoted text 10 lines
escreveu: On 2016-05-09 16:22, Mazo Winst wrote: > Is there any way to invoke a method passing parameters through rtti? Yes, it should be possible. Take a look at the FPCUnit (unit testing framework) included with FPC. The testing framework invokes methods and passes parameters around. Regards, Graeme

Does the framework knows the method signature at compile time?

I will take a look. Thanks for the tip.

Best regards

Reply by email

Sven Barth
to Mazo Winst: Em segunda-feira, 9 de maio de 2016, Sven Barth to the method to an approbiate method…
"Mazo Winst" wrote 10 lines
Em segunda-feira, 9 de maio de 2016, Sven Barth < escreveu: > Am 09.05.2016 17:23 schrieb "Mazo Winst" : >> >> Is there any way to invoke a method passing parameters through rtti? > > As long as you know the signature of the method you can cast the

pointer to the method to an approbiate method variable and call that. For dynamic calls you'll need to wait for Invoke() support which is on the ToDo list, but there's no ETA yet.

> In my use case,the name of the method are name is not the problem. The signature is. As long as you know the

signature at compile time you won't have any trouble currently. Everything else you'll need to do yourself currently.

Regards,
Sven

Reply by email

Michael Schnell
to Sven Barth: As long as you know the signature of the method you can cast the pointer to the method to…
Sven Barth wrote 6 lines
As long as you know the signature of the method you can cast the pointer to the method to an approbiate method variable and call that. For dynamic calls you'll need to wait for Invoke() support which is on the ToDo list, but there's no ETA yet.

Will this result in a new kind of Pascal Script support ? (In the German Forum there recently had been discussions on Pascal script not working decently on 64 Bit archs.)

-Michael

Reply by email

Sven Barth
to Michael Schnell
"Michael Schnell" wrote 5 lines
On 05/09/2016 05:36 PM, Sven Barth wrote: > > > As long as you know the signature of the method you can cast the pointer

to the method to an approbiate method variable and call that. For dynamic calls you'll need to wait for Invoke() support which is on the ToDo list, but there's no ETA yet.

> Will this result in a new kind of Pascal Script support ? (In the German

Forum there recently had been discussions on Pascal script not working decently on 64 Bit archs.)

Don't know as I'm not using PascalScript, but potentially it could be.

Regards,
Sven

Reply by email