I am creating a COM Object in Delphi XE2. I am trying to create the methods using safecall, but the default is stdcall.
When i use Automation Object is possible to use safecall.
For performance questions, i am using COM Object. Is it possible to use safecall on it?
Thanks
Yes, you can use
safecallconvention.The only difference between
safecallandstdcallis thatsafecallis suitable for exception-driven flow. That is, if your Delphi function issafecall, it can raise an exception, which will be catched internally and translated to the proper HRESULT.By the way, there’s no performance benefit with COM Object vs Automation object: although an Automation object supports the slower “late binding” via
IDispatchinterface, its clients are not obliged to use it. Clients, which are able to use “early binding”, can use it with Automation objects as well.