Board index » delphi » Importing tlb with windows structures

Importing tlb with windows structures

I am writing a com server and for various reasons I am not using
oleautomation interfaces. The server is to be deployed in-process and
remote. The server is built as follows:

1. The interfaces are defined in IDL then compiled using MIDL to produce C
headers, a marhsalling dll, and a Type Library.

2. The type library is opened using Delphi in order to generate a pascal
translation of the interfaces. There is no type library actually linking
into the server - marshalling is done via the DLL generated at (1). The
server is then written with delphi using these translations.

The idl file contains a number of custom types, structures etc.. and one of
the interfaces uses a 'standard' structure from Windows.h - actually
SYSTEMTIME. The C header files (generated by MIDL) seem correct but when I
open the type library into the Delphi Type Library the pascal translation
contains a redefinition of 'SYSTEMTIME' even though, even though the unit
uses 'Windows.pas' which contains the real definition of SYSTEMTIME.

Is there any way I can stop this? I have a vague idea that this is something
to do with the importlib statement the 'library' section of my IDL file. At
the moment I am only importing stdole2.tlb. Is there another standard
library that contains all the standard structures, and if there was would
importing it help?

regards,

Martin Lafferty

 

Re:Importing tlb with windows structures


This is one of those things that the TL Import will not do. If you want to
preserve the definitions from Windows.pas, just eliminate them from the _TLB
file manually after the import.

--
have fun
Binh Ly
http://www.techvanguards.com

Quote
"Martin Lafferty" <mart...@prel.co.uk> wrote in message

news:3b4c3ab9$1_1@dnews...
Quote
> I am writing a com server and for various reasons I am not using
> oleautomation interfaces. The server is to be deployed in-process and
> remote. The server is built as follows:

> 1. The interfaces are defined in IDL then compiled using MIDL to produce C
> headers, a marhsalling dll, and a Type Library.

> 2. The type library is opened using Delphi in order to generate a pascal
> translation of the interfaces. There is no type library actually linking
> into the server - marshalling is done via the DLL generated at (1). The
> server is then written with delphi using these translations.

> The idl file contains a number of custom types, structures etc.. and one
of
> the interfaces uses a 'standard' structure from Windows.h - actually
> SYSTEMTIME. The C header files (generated by MIDL) seem correct but when I
> open the type library into the Delphi Type Library the pascal translation
> contains a redefinition of 'SYSTEMTIME' even though, even though the unit
> uses 'Windows.pas' which contains the real definition of SYSTEMTIME.

> Is there any way I can stop this? I have a vague idea that this is
something
> to do with the importlib statement the 'library' section of my IDL file.
At
> the moment I am only importing stdole2.tlb. Is there another standard
> library that contains all the standard structures, and if there was would
> importing it help?

> regards,

> Martin Lafferty

Re:Importing tlb with windows structures


Quote
> This is one of those things that the TL Import will not do. If you want to
> preserve the definitions from Windows.pas, just eliminate them from the
_TLB
> file manually after the import.

Thank you for your reply. In fact, the type mismatch turned out to be less
of a problem that I thought it would be. I suspect that so long as the
structures are equivalent (which they should always be) I should be OK.

Other Threads