[fpc-devel] importtl - importing typelib

Ludo Brands ludo.brands at free.fr
Tue Dec 27 10:54:48 CET 2011


> in activeds.tlb, there is a fragment that references non 
> existing identifiers that have "internal" naming:
> 
> ADSTYPEENUM = __MIDL___MIDL_itf_ads_0000_0000_0001;
>      ADS_OCTET_STRING = __MIDL___MIDL_itf_ads_0000_0000_0002;
>      P__MIDL___MIDL_itf_ads_0000_0000_0002 =
>         ^__MIDL___MIDL_itf_ads_0000_0000_0002;
>      __MIDL___MIDL_itf_ads_0000_0000_0002 = packed record
>      dwLength : LongWord;
>      lpValue : PByte;
>  end;
> 
Thank you for testing. Activeds.tbl has another few unhandled
particularities I hadn't encountered before.

I've reworked the complete alias/record/union import. The above example is
something that C can handle with incomplete  typedefs but pascal can't. The
approach now is to defer type declarations until all user_types used have
been declared, external or internal. In case of circular references, an
error message is added to the header so that the user can either solve the
circular reference or remove the types.

> Similarly, the huge mshtml (IE9) html had several failures. 
> The first two were fixable 
> 
> 1. defining true=1 and false=0.
> 2. Somewhere a pointer type was referenced before definition (one line
> lower) (same code fragment as (3), see below)
> 3. same problem as activeds, types that have "internal" names.
> 
> //records, unions, aliases
>  wireHDC = P_RemotableHandle;             // problem  (2), 
> only defined
> 						a line lower
>  P_RemotableHandle = ^_RemotableHandle;
> 
>  _RemotableHandle = packed record
>      fContext : Integer;
>      u : __MIDL_IWinTypes_0009; // (3) unknown problem.
>  end;
> 

1. added a check against reserved identifiers in all places. 
2,3. same as activeds

Added also support for unions.

Both files compile now.

Patch attached to http://bugs.freepascal.org/view.php?id=20972

Ludo




More information about the fpc-devel mailing list