views:

468

answers:

2

Delphi versions before 2010 had an option in the Delphi Environment that one could set: "All v-table interfaces". This would change the calling convention when importing type libraries. In 2010, the option is gone. How do I import a type library with the safecall calling convention? I'm hoping maybe there is a more granular level of control in 2010 than previous versions, but regardless - how do I do this now?

Thanks.

A: 

If you look at the resulting .ridl file that is generated, you will see that the methods have _stdcall defined.

You have a finer level of control using the .ridl files now.

Robert Love
These type libraries are coming from *other* applications. I do not have a .ridl file for them. I am *importing* the library. Thank-you for the attempt.
Steven
+1  A: 

I haven't tried using the "All v-table interfaces" option in the Delphi 2010 IDE. It was definitely broken in D2009.

You can use the command-line tlibimp tool to create the _tlb.pas files you need:

tlibimp -P -Pt <tlb file>
Alistair Ward
I noticed that the help info for tlibimp incorrectly states that the parameter to do this is -Pt-. It should be -Pt or -Pt+.
Doug Reece
What the help info doesn't tell you is that it is showing you the default settings for each of the options. -Pt- in the help is saying the "Map all HRESULT to safecall" is off by default - I've been caught by this one as well :-(
Alistair Ward