
#importing a typelibrary with non-8 byte alignment
There is no alignment property in the type library. In fact VB uses
a four byte alignment which is incompatible with the #import
pragma. Automation added structures but didn't say anything
anout alignment. If we consider the VB behavior as the standard,
4-byte alignment it is...
Shortly, don't rely on type libraries...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
Quote:
> Hi,
> I have a type library generated by Delphi with 1-byte alignment and I want
> to use it from VC++
> When I import the .tlb file usign the #import VC++ generates a .tlh
wrapper
> file with 8-byte alignment
> ...
> #pragma pack(push, 8)
> ...
> When generating the type library with MIDL I've tryed to spec. the "/align
> 1" or "/pack 1" or "/Zp1", but the #import seems to ignore the type
library
> alignment setting and always use 8-byte alignment.
> So, at the moment I modify the .tlh file to 1 byte alignment and include
> this file instead of importing the type library.
> Is it possible to specify the you want to use 1 byte allignment when
> importing a type library??
> Regards,
> Morten S?rensen