[Solved] Error importing TopSolid_TLB in Delphi (2005-2007)

All topics about specific development with COM interface, LIP language, API in VB, ...

Moderators: remi77, jacs, Daniel

gvdvenis
Private First Class
Private First Class
Posts: 16
Joined: Thu Apr 12, 2007 10:36 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.26
Location: Zutphen
Contact:

[Solved] Error importing TopSolid_TLB in Delphi (2005-2007)

Unread post by gvdvenis »

Hi there,

When i try to import the TopSolid type library into delphi 200x then the resulting component contains corrupt declaration interpretations. There could be two causes for this:
1: An incorrect interpretation of the declarations in the type library by Delphi
2: Some other problem that causes incompatibility issues when importing/conversion to delphi/pascal code.

So my actual question would be: How can i check the correct declaration of the functions and procedures in the TopSolid typelib, so i can correct conversion/implementation errors by hand if possible. There seems to be no in-depth documentation about this, please point me out if I'm wrong...
Regards,

Gert
AxelW
Private
Private
Posts: 3
Joined: Tue Apr 10, 2007 12:19 am
Location: British Columbia
Contact:

Unread post by AxelW »

Hello

I have run into similar issues with Delphi 7. This may be a .NET requirement but the type libraries showed the following issues:
1. Type library declared reserved names for Delphi
2. Duplicate declarations for TApplication, TShape, {maybe TDocument}

I tried renaming the duplicates but the Documents.Add still failed.
gvdvenis
Private First Class
Private First Class
Posts: 16
Joined: Thu Apr 12, 2007 10:36 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.26
Location: Zutphen
Contact:

Unread post by gvdvenis »

actually, to be more specific, this is what happens:

When I try to create a component wrapper for the typelib, it creates for example the following class declaration for me:

Code: Select all

TApplication = class(TOleServer)
  private
    ...
  protected
    ...
  public
    constructor Create(AOwner: TComponent); override; //<- here it goes wrong...
upon compiling this generates the following error: "[DCC Error] TopSolid_TLB.pas(5191): E2037 Declaration of 'Create' differs from previous declaration"

This implies that the problem lies somewhere in the base class, which is the TOleServer class, but i checked and nothing seems wrong there... I also posted this on some delphi newsgroups, but till now nobody was able to tell me what is causing this trouble. As a side note: this problem only exists when i let delphi create a component wrapper for the TLB, so this leads me to believe that the real problem is caused by delphi, but just maybe there's someone reading this who has a solution for this somewhat odd problem...
hobby's are for amateurs
AxelW
Private
Private
Posts: 3
Joined: Tue Apr 10, 2007 12:19 am
Location: British Columbia
Contact:

Unread post by AxelW »

I think the TComponent definition is being created by the Type library which clashes with the native TComponent

See...
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
TComponentProperties= class;
{$ENDIF}
TComponent = class(TOleServer)

I tried to rename to:
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
TComponentProperties= class;
{$ENDIF}
TComponent2 = class(TOleServer)
private
gvdvenis
Private First Class
Private First Class
Posts: 16
Joined: Thu Apr 12, 2007 10:36 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.26
Location: Zutphen
Contact:

does nothing...

Unread post by gvdvenis »

This indeed did the trick! You're the man! Thanks a lot!
hobby's are for amateurs
gvdvenis
Private First Class
Private First Class
Posts: 16
Joined: Thu Apr 12, 2007 10:36 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.26
Location: Zutphen
Contact:

Unread post by gvdvenis »

Another problem occurred after the first one... When trying to install the components on the component pallet, an error message appears, telling you that the TShape class is already registered in another package. This is due to the same cause as the previous problem. To overcome this one just rename all instances of TShape to TTopShape for example, then recompile, install the package and enjoy using the components!

Note: Although i haven't had problems with it yet, i suppose that the TApplication class could also cause some trouble in the future, so you might also want to rename that class too. Hope this helps anyone struggling his/her way through these issues...
hobby's are for amateurs
Mark Oostveen
Chief
Chief
Posts: 107
Joined: Mon Mar 26, 2007 9:40 am
TopSolid Module: TopSolid'Cam
TopSolid Version: 6.26
Location: The netherlands
Contact:

Unread post by Mark Oostveen »

Hi Gert,

Maybe you should call you reseller :)

I am sure he has the answer...
Oh, I have to check but we "avoid" importing the type library.. But we can use it.

Regards

Gert's Reseller

Mark Oostveen
Bemet International B.V.
Holland
gvdvenis
Private First Class
Private First Class
Posts: 16
Joined: Thu Apr 12, 2007 10:36 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.26
Location: Zutphen
Contact:

Unread post by gvdvenis »

Hi Mr reseller,
Actually i DID call my reseller, but they sent me with a kluitje in het riet! Also, i'm not sure if you understood what i wrote in my previous post.. I already solved the problem myself... Just read and weep... 8)
hobby's are for amateurs
Mark Oostveen
Chief
Chief
Posts: 107
Joined: Mon Mar 26, 2007 9:40 am
TopSolid Module: TopSolid'Cam
TopSolid Version: 6.26
Location: The netherlands
Contact:

Unread post by Mark Oostveen »

Hi Gert,

That's not very nice that they sent you with a kluitje in het riet.... :)

Sorry for that.. I will kill my responible collegue at once.

But the renaming is not the only option..

I am going to tell you how we did.. And I will post.

Mark
gvdvenis
Private First Class
Private First Class
Posts: 16
Joined: Thu Apr 12, 2007 10:36 am
TopSolid Module: TopSolid'Design
TopSolid Version: 6.26
Location: Zutphen
Contact:

Unread post by gvdvenis »

Can't wait :P
hobby's are for amateurs
Post Reply