[fpc-devel] Does FreePascal support named parameters?

Frank Church vfclists at gmail.com
Tue Apr 2 23:00:04 CEST 2013


On 2 April 2013 04:37, Anthony Walter <sysrpl at gmail.com> wrote:

> Name parameters are supported through variants.
>
> procedure Test(V: Variant);
> begin
>   V.SomeMethod(12, ParamOne := '', ParamTwo := 12.5);
> end;
>
> Internally what happens is V is checked to for IDispatch, next
> GetIDsOfNames is called to find the dispid of SomeMethod, then a variant
> array of arguments is constructed (with the names), and finally Invoke is
> called.
>
> This comes from the Microsoft COM concept of "automation",
> though automation encompasses a bit more than IDispatch, including
> marshalling, remoting, and error handling; passing errors back from a
> remote machine for example.
>
> People don't really use this stuff much anyone, nor is their much demand
> for people with knowledge of the inner workings of COM. But if you want,
> you can write your own objects which implement IDispatch.
>
> See the source code in the download link on this page:
> http://www.codebot.org/delphi/?doc=9573
>
> ScripTools.pas class TScriptlet which exposes arbitrary pascal methods and
> properties to a Javascript engine.
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
>

Does this work on Linux as well, or is it only for Windows?
-- 
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20130402/28372083/attachment.html>


More information about the fpc-devel mailing list