Is anyone aware of a COM compatible (from an ABI s...
# kotlin-native
g
Is anyone aware of a COM compatible (from an ABI standpoint) implementation for Kotlin Native? Want to make bindings for the SDK that is used to make virtual instruments and audio effect plugins: • https://github.com/steinbergmedia/vst3sdk But it's C++, and uses a COM based API with interfaces you're meant to implement. So the one way to do it would be to model the vtables as structs in C, and try to bind to those in KN:
Copy code
typedef struct FUnknown_vtbl {
    tresult (*queryInterface)(void* this_ptr, const TUID iid, void** obj);
    uint32 (*addRef)(void* this_ptr);
    uint32 (*release)(void* this_ptr);
} FUnknown_vtbl;

typedef struct FUnknown_def {
  FUnknown_vtbl* vtable,
  int iid[16]
} FUnknown_def;

/* class ISomething : public FUnknown { 
 *   public:
 *     virtual int someInt() = 0;
 */
typedef struct ISomething_vtbl {
  FUnknown_vtble funknown_vtable;
  int (*someInt)(void* this_ptr);
} ISomething_vtbl;
Just curious if someone has already done this or has any tips/knows of a better way? Thank you 🙏