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. Structs and byte array pointers

Structs and byte array pointers

Scheduled Pinned Locked Moved C#
csharpvisual-studiocomdata-structuresbeta-testing
3 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.
  • T Offline
    T Offline
    TFB
    wrote on last edited by
    #1

    I am new to C# and am trying to call some old legacy C stuff that accepts as input a pointer to a struct that has several fields that are pointers to large byte arrays. I am able to get a clean build but am not able to run without getting an exception that says something like unable to marshal structure field of this type (it's referring to the array pointer (reference) fields). I have even tried unsafe mode but have had problems taking the address of an array. I am using the Beta-2 Visual Studio. tfbriscoe@msn.com Tom

    N 1 Reply Last reply
    0
    • T TFB

      I am new to C# and am trying to call some old legacy C stuff that accepts as input a pointer to a struct that has several fields that are pointers to large byte arrays. I am able to get a clean build but am not able to run without getting an exception that says something like unable to marshal structure field of this type (it's referring to the array pointer (reference) fields). I have even tried unsafe mode but have had problems taking the address of an array. I am using the Beta-2 Visual Studio. tfbriscoe@msn.com Tom

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      tfbriscoe wrote: I am using the Beta-2 Visual Studio Well, not sure of the exact changes in the Marshal class, however why don't you post a little code so everyone can take a look at what you are doing.


      Nick Parker

      You see the Standards change. - Fellow co-worker

      T 1 Reply Last reply
      0
      • N Nick Parker

        tfbriscoe wrote: I am using the Beta-2 Visual Studio Well, not sure of the exact changes in the Marshal class, however why don't you post a little code so everyone can take a look at what you are doing.


        Nick Parker

        You see the Standards change. - Fellow co-worker

        T Offline
        T Offline
        TFB
        wrote on last edited by
        #3

        Hi Nick. Thanks for your willingness to help! I solved the problem yesterday in both managed and unsafe modes. Just had to do a little more research about unsafe mode, "fixed" code groups, and structure layout attributes!

        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