VC++ 2005 1 byte Alignment

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
 
B

Ben Voigt

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top