Support Statement: Retaining Short in a COM API
Options for COM type short
There are three options for dealing with type=short in COM APIs:
- Standardize on short-to-int for all libraries (this is the default. Generally best if you plan to migrate to a managed API)
- Standardize on short-to-short for all libraries (generally needed if you plan to use COM interop)
- Mixed: some libraries use short-to-short and others use short-to-int.
As for option 3: We can do this at the library (IDF) level if you tell us which libraries should use short-to-short and which should use short-to-int.Â
Doing it at the member/argument level can also be done, but it requires detailed specification of each exception from the setting for the containing library.
Retaining type short for COM interop
COM IDFs sometimes declare API elements as having type short. However, most .NET APIs are favor type int (i.e., Int32). You will generally use an integer in a .NET API where you used a short in a COM API. Consequently, the default IDF files prepared by gmBasic will Integer instead of Short. Â
However, if you are planning to use interop as the upgrade strategy for a COM API, you will need to retain type Short in your IDF so it that short will be used in the translations. Retaining a short in an IDF is done by passing TypeInteger=short on the command line when you generate the IDFs for those particular COM files.  The IDF generation process is mostly automated, but you can find the command line string for generating an IDF in the gmStudio application settings, gmStudio.cfg, file. It is the variable IdlToXmlCmd:
|