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. C#
  4. marshaling an array of structs

marshaling an array of structs

Scheduled Pinned Locked Moved C#
csharpc++data-structureshelp
1 Posts 1 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.
  • D Offline
    D Offline
    damianrda
    wrote on last edited by
    #1

    trying to marshall over some data from an unmanaged dll, however i heard that the marshaller cannot marshall an array of structs, in a struct. c++: #pragma pack(1) typedef struct{ unsigned short propCnt; PRO_PROPERTY prop[200]; <-- this shit here... } PRO_CHANGEDPROPERTY; #pragma pack() #pragma pack(1) typedef struct{ long apiCode; PRO_DATA data; } PRO_PROPERTY; #pragma pack() c#: [StructLayout(LayoutKind.Sequential, Pack = 1)] public unsafe struct ProChangedProperty { public UInt16 propCnt; [MarshalAs(UnmanagedType.Struct, SizeConst = 200)] public ProProperty[] prop; } [StructLayout(LayoutKind.Sequential, Pack = 1)] public struct ProProperty { public Int32 apiCode; public ProData data; } i cant seem to figure this one out, any help would be appreciated.

    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