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. Managed C++/CLI
  4. Object * to (void *,size_t) and back

Object * to (void *,size_t) and back

Scheduled Pinned Locked Moved Managed C++/CLI
questiondata-structuresperformancehelp
2 Posts 1 Posters 4 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.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    Class MX is a managed wrapper for the unmanaged (and unmodifiable) class X. If you look the code below you'll see the main question: how do I get a void * pointer (to a size_t memory array) from an Object obj? And then, how do I come back from data and size to obj? The only restriction I can admit on obj is that it has to be serializable. I suppose I could use a MemoryStream and a BinaryFormatter but I can't figure how. Thanks to anyone who can solve this problem. :rose::rose::rose:A. public __gc class MX { private: X * x; public: MX(Object * obj) { void * data; size_t size; /*Problem 1*/ x = new X(data,size); } Object * get_Object() { void * data = x->get_data(); size_t size = x->get_size(); Object * obj; /*Problem 2*/ return obj; } }

    A 1 Reply Last reply
    0
    • A Anonymous

      Class MX is a managed wrapper for the unmanaged (and unmodifiable) class X. If you look the code below you'll see the main question: how do I get a void * pointer (to a size_t memory array) from an Object obj? And then, how do I come back from data and size to obj? The only restriction I can admit on obj is that it has to be serializable. I suppose I could use a MemoryStream and a BinaryFormatter but I can't figure how. Thanks to anyone who can solve this problem. :rose::rose::rose:A. public __gc class MX { private: X * x; public: MX(Object * obj) { void * data; size_t size; /*Problem 1*/ x = new X(data,size); } Object * get_Object() { void * data = x->get_data(); size_t size = x->get_size(); Object * obj; /*Problem 2*/ return obj; } }

      A Offline
      A Offline
      Anonymous
      wrote on last edited by
      #2

      I've a similar problem and I don't know how to solve it. I hope some Guru here knows the solution. Jenny. C.H.Y.S.P.R.xxx

      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