Unmanaged void* to .Net System::Array

A

Andrew Nefiodovas

I have an unmanaged C++ class representing a 2D matrix. It holds a
pointer to a block with the actual data, and fields indicating the
number, size and type of the matrix elements. Like this:

public class UnmanagedMatrix {
public:
void * block;
long rows;
long cols;
int type; //refers to an enum of possible types - char, long, double,
etc.
long sizeOfBlockType;
....
}

I am writing a managed wrapper to use this class from within .Net with
a member pointer to the unmanaged class in the usual way:

public __gc class ManagedMatrix {
private:
UnmanagedMatrix __nogc* pM;
....
}

I need the wrapper class to get and set the unmanaged block of matrix
data using System.Arrays. i.e I need methods like this:

public:
System.Array getData() {}
void setData(System.Array data) {} // maybe pass in the type as well?

Any help with these two methods would be appreciated.
I am not at liberty to modify the unmanaged class.
I am a C++ novice.
 
V

Victor Bazarov

Andrew said:
I have an unmanaged C++ class [...]
I am writing a managed wrapper to use this class from within .Net [...]

Any help with these two methods would be appreciated.
I am not at liberty to modify the unmanaged class.
I am a C++ novice.


Please post to 'microsoft.public.vc.language'. "Managed" is off-topic
here. Here we discuss _only_ standard C++ language.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top