How can I define packed structure in IDL?
-
How can I define packed structure in IDL? Most of compilers align structure in 4/8 bytes. IN VC++ 6.0, we can control this by using '#pragma pack' directive. But, how can we do the same thing in IDL? I tried to using '#pragma pack' directive in IDL like we do in c++. It looks successful only in COM-Server Project. Compiler-made Header file in server project has '#pragma pack' directives enclosing structure-definition. But, client project using '#import My.tlb' has failed. My.tlh file defines this (I expect to be packed) as unpacked structure(maybe 8byte-align). How can I define structure as packed? I want structure to be packed in Header files made by MIDL(includes tlh). And, Proxy/Stub code made automatically refelcts this. How can I solve it? thanks~
-
How can I define packed structure in IDL? Most of compilers align structure in 4/8 bytes. IN VC++ 6.0, we can control this by using '#pragma pack' directive. But, how can we do the same thing in IDL? I tried to using '#pragma pack' directive in IDL like we do in c++. It looks successful only in COM-Server Project. Compiler-made Header file in server project has '#pragma pack' directives enclosing structure-definition. But, client project using '#import My.tlb' has failed. My.tlh file defines this (I expect to be packed) as unpacked structure(maybe 8byte-align). How can I define structure as packed? I want structure to be packed in Header files made by MIDL(includes tlh). And, Proxy/Stub code made automatically refelcts this. How can I solve it? thanks~
Hi, I'm not completely positive as I haven't tried this, but try using the #pragma pack directive like: #pragma pack(push, 1) #import ... #pragma pack(pop) Let me know if this works for you. Mark