Island COM support is a work in progress, IDispatch isn’t supported at this point, (that is, there’s no dynamic support that ends up calling into IDispatch, the interface itself could be imported and called directly). There is no marshaling going on in Island at all. Which is the reason we have these elements for each interface, since Elements interfaces aren’t compatible with COM:
- IUnknown: Elements only interface type, this is what a class that implements IUnknown should implement. This is not compatible with a COM interface and thus should not be used in parameter signatures that pass between different types.
- IUnknownPtr COM compatible interface type, this is cast compatible (back and forward) with an IUnknown type, and is used when passing things to and from another COM language, this should be used in exported signatures, and when calling external methods that implement IUnknown.
- IUnknown_UID GUID for IUnknown (readonly variable).
Differences in COM support between Delphi and Island:
- Result interface types/string types should be passed as a last out parameter in Elements.
Now we don’t want people to have to write this all themselves, so there are two aspects that can be used to make this all be generated automatically. These aspects are:
- ComInterface This can be applied to an (elements) interface that has a Guid attribute, it will create *_Vmt, *Ptr for you for this interface.
- ComObject This can be applied to a class that implements COM interfaces so the AddRef, Release, queryinteface methods are generated automatically (and reference counting works).
- IUnknown_VMT The VMT for the default IUnknown bridge implementation (readonly variable)
- ElementsCOMInterface Record type that’s used to make reference work for Island based objects that implement a COM interface.
- COMHelpers Helper class that can be used to create and retrieve COM
The source to all of this can be found here: