Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. COM
  4. How can I define packed structure in IDL?

How can I define packed structure in IDL?

Scheduled Pinned Locked Moved COM
comquestionc++sysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    magicast
    wrote on last edited by
    #1

    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~

    M 1 Reply Last reply
    0
    • M magicast

      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~

      M Offline
      M Offline
      Mark Janveaux
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups