Unable to register a 3rd party type library for use in Delphi

185 views Asked by At

OS: Windows 11 64bit

The software development company I work for has a customer that requires integration to the Sage 50 account DB. After much back and forth communications with Sage UK, we have finally received their Sage 50 SDK. This SDK is developed for C# and/or VB.Net developers. However, I do remember that this ought not to be a problem to import and consume in Delphi.

I have successfully:

  1. Registered the Sage type library (SageDataObject280.tlb) in Windows. Imported the type library into Delphi.

  2. I had to overcome a few issues with already registered required packages and the package was built successfully.

  3. This generated the SageDataObject280_TLB.pas.Upon installing this type library, all the class objects were registered in the Delphi tool palette and I have access to them all.

  4. I have registered the type library server using the Delphi tool TRegsvr.exe (Problem is actually here).

  5. I have created a small proof of concept app to test all our required functionality.

  6. I am able to connect to a Sage 50 account DB successfully. However, when I try to invoke any of the other objects, I get the old 'Class not registered' error message.

Upon inspecting the registry, I discovered that all the IID (interface ID's) are all registered correctly. However, NONE of the classes (CLSID) themselves are registered, which naturally gives rise to the above mentioned error message.

I have got the source code for the TRegsvr tool and tracing through the code, I see that the registration process uses the Windows ActiveX registration method, over which I have no control. I have spent an inordinate number of hours, in fact two entire working days, Googling this issue but cannot get a satisfactory answer as to how to resolve this issue.

This is a dealbreaker for us because if I can't get past this, it means we cannot supply the customer with the desired solution.

Here is a small snippet of the type library PAS file.

unit SageDataObject280_TLB;
...
uses Winapi.Windows, System.Classes, System.Variants, System.Win.StdVCL, Vcl.Graphics, Vcl.OleServer, Winapi.ActiveX;
  

    // *********************************************************************//
    // GUIDS declared in the TypeLibrary. Following prefixes are used:        
    //   Type Libraries     : LIBID_xxxx                                      
    //   CoClasses          : CLASS_xxxx                                      
    //   DISPInterfaces     : DIID_xxxx                                       
    //   Non-DISP interfaces: IID_xxxx                                        
    // *********************************************************************//
    const
      // TypeLibrary Major and minor versions
      SageDataObject280MajorVersion = 28;
      SageDataObject280MinorVersion = 0;

      LIBID_SageDataObject280: TGUID = '{D7F4B92E-F1B4-4996-80D1-76AC2448EDAB}';
    ...
      DIID_ISalesRecord: TGUID = '{C18182B6-F2D2-11D0-9E63-008048AADD4E}';<-All DIID registered OK
      CLASS_SalesRecord: TGUID = '{C18182B8-F2D2-11D0-9E63-008048AADD4E}';<-No CLASS objects registered
    ...

It would be awesome if someone could provide a solution to this. I may be missing something so obvious that I will kick myself when the solution is presented to me!

0

There are 0 answers