The ID is the integer id of the class you wish to create. So you only have to export two routines from you DLL. If you have a CreateInterface type routine where you pass the ID and it will create an instance of the object and return it to the calling application. Like such:You now have a factory that can create and return any of the interfaces you support.Code:procedure CreateInterface(aIID: Integer; var aObj); stdcall; begin case aIID of 0: TMyClass0(aObj) := TMyClass0.Create; 1: TMyClass1(aObj) := TMyClass1.Create; end; end; procedure DestroyInterface(var aObj); stdcall; begin FreeNilObject(aObj); end;
Bookmarks