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
  1. Home
  2. General Programming
  3. COM
  4. [string] atttribute ??

[string] atttribute ??

Scheduled Pinned Locked Moved COM
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.
  • G Offline
    G Offline
    Glenn Wardius
    wrote on last edited by
    #1

    I define this struct in my IDL: typedef struct PATIENT_INFO { [string] wchar_t wszLastName[ 50 ]; [string] wchar_t wszPatientID[ 30 ]; } PATIENT_INFO; When I compile I get this error: midl\oleaut32.dll : error MIDL2020 : error generating type library : LayOut failed on struct : __MIDL___MIDL_itf_PatientTestSvr_0000_0001 When I take out the [string] attribute it compiles fine. It is my understanding that the [string] attribute means only the NULL terminated string itself will get marshalled and not the whole buffer (which is the behavior I want). Is my understanding correct and how can I get this to compile? Glenn Wardius GE Medical Systems

    J 1 Reply Last reply
    0
    • G Glenn Wardius

      I define this struct in my IDL: typedef struct PATIENT_INFO { [string] wchar_t wszLastName[ 50 ]; [string] wchar_t wszPatientID[ 30 ]; } PATIENT_INFO; When I compile I get this error: midl\oleaut32.dll : error MIDL2020 : error generating type library : LayOut failed on struct : __MIDL___MIDL_itf_PatientTestSvr_0000_0001 When I take out the [string] attribute it compiles fine. It is my understanding that the [string] attribute means only the NULL terminated string itself will get marshalled and not the whole buffer (which is the behavior I want). Is my understanding correct and how can I get this to compile? Glenn Wardius GE Medical Systems

      J Offline
      J Offline
      Joseph Dempsey
      wrote on last edited by
      #2

      first rid yourself of the [50]'s cause you don't need them. the string attribute tells MIDL to look for the null terminator and it does size calculations on its own. Next get rid of the typedef. MIDL doesn't need it. just use struct PATIENT_INFO { [string] wchar_t wszPatientID; [string] wchar_t wszLastName; }; Hope this helps ya out. Joseph Dempsey jdempsey@cox.rr.com Joseph.Dempsey@thermobio.com "Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning." --anonymous

      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