B
BartMan
Greetings,
I am working on a project where the interface from the UI application (done
in C#) requires that an image buffer be passed back as a byte[] array as
defined by an interface.
The problem is that the device uses a legacy c style buffer of unsigned
char* to hold its image data. I wrote a C++\Clr wrapper around the legacy c
stuff. Which is working really well with other features of the device.
But now I am trying to figure out how I can get my legacy buffer into a
byte[] buffer that the .Net application is requesting?
For example:
// The .Net C# defined interface
interface IImageRetrieval
{
void GetImage(byte [] buffer);
}
// C++\Clr object
public ref class TestClass : public IImageRetrieval
{
public:
virtual void GetImage(System::Byte [] buffer)
{
unsigned char* pBuffer = contains jpeg image data from a device.
// HOW DO I CONVERT THE UNMANAGED TO MANAGED BYTE [] for C#?
buffer = pBuffer????
}
};
Thanks in advance for any suggestions!
I am working on a project where the interface from the UI application (done
in C#) requires that an image buffer be passed back as a byte[] array as
defined by an interface.
The problem is that the device uses a legacy c style buffer of unsigned
char* to hold its image data. I wrote a C++\Clr wrapper around the legacy c
stuff. Which is working really well with other features of the device.
But now I am trying to figure out how I can get my legacy buffer into a
byte[] buffer that the .Net application is requesting?
For example:
// The .Net C# defined interface
interface IImageRetrieval
{
void GetImage(byte [] buffer);
}
// C++\Clr object
public ref class TestClass : public IImageRetrieval
{
public:
virtual void GetImage(System::Byte [] buffer)
{
unsigned char* pBuffer = contains jpeg image data from a device.
// HOW DO I CONVERT THE UNMANAGED TO MANAGED BYTE [] for C#?
buffer = pBuffer????
}
};
Thanks in advance for any suggestions!