I have this code:

unit No_NULL; {$WARN SYMBOL_PLATFORM OFF} interface uses ComObj, ActiveX, StdVcl, S4_TLB, sbserver_TLB,Windows, Variants; const Class_Splugin: TGUID = '{6F9619FF-8B86-D011-B42D-00C04FC964FF}'; type Splugin = class(TAutoObject, ISearchPlugin, ISearchPluginArticles, ISearchPluginSP, ISearchPluginDocument) public protected function ErrorMessage(ErrorCode: Integer): WideString; safecall; ... implementation uses ComServ, Dialogs, SysUtils, Controls; function Splugin.ErrorMessage(ErrorCode: Integer): WideString; begin end; ... initialization TAutoObjectFactory.Create(ComServer, Splugin, Class_Splugin, ciMultiInstance, tmApartment); end. 

It works great, but I need a library at the exit. When I change the unit to the library, it starts to find fault with each line. Where is the mistake?

    1 answer 1

    You need to create a new project type dll library. Connect your module to it and write the following in the dpr file

     library No_NULLLib; uses ComServ, // Подключаем наш модуль No_NULL in 'No_NULL.pas'; exports // Экспортируем функции для работы с COM DllGetClassObject, DllCanUnloadNow, DllRegisterServer, DllUnregisterServer; {$R *.RES} {$R S4.tlb} // Добавляем tlb себе в ресурсы end.