Object * to (void *,size_t) and back
-
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; } }
-
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; } }
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