VC++ 2005 1 byte Alignment

  • Thread starter Thread starter Asfar
  • Start date Start date
A

Asfar

Hi,

I have created a mfc extension dll in VS2005. In code generation I set the
Alignemnt to 1Byte and compile. This works fine.
Now I add clr support to my dll and i get errors when linking.
error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x02000029)Any idea if I need to change project setting
for a MFC Extension Dll using Clr?Thanks,Asfar
 
Asfar said:
Hi,

I have created a mfc extension dll in VS2005. In code generation I set
the Alignemnt to 1Byte and compile. This works fine.

No, it compiles fine. There's a difference :)
Now I add clr support to my dll and i get errors when linking.
error LNK2022: metadata operation failed
(8013118D) : Inconsistent layout information in duplicated types
(tagTEXTMETRICA): (0x02000029)Any idea if I need to change project setting
for a MFC Extension Dll using Clr?Thanks,Asfar

You should not change structure packing globally, only for your own data
types. The managed compiler "knows" the correct packing for system types
and throws an error where the native compiler didn't. It's a real bug you
need to fix. Use "#pragma pack" to set packing, and do it selectively,
don't set the project property (at least not for files that call into the
Win32 API).
 
Back
Top