I am trying to call a function in C from C# though c ++
so basically C# -> C++ - >C
In C#, I have byte[] bytes - which reads the information from the file. I am passing the byte array and the size to C++ .
In C++ I get the byte array and the size but I am not able to convert to the specific data types.
Expand|Select|Wrap|Line Numbers
- void Image::OpenMemFile(array<Byte>^ data, unsigned int size)
- {
- Free();
- m_dataStream = data;
- Byte const* streamData = &data[0]; // this is where it throws error
- // Should I use marshaling here ? What call should that be ?
- hImage = ::OpenMemImage(streamData , size);
- modified = false;
- }
- // this is the function I need to call
- EXIVSIMPLE_API HIMAGE OpenMemImage(const BYTE *data, unsigned int size)
- {
- // code
- imgWrap->image = Exiv2::ImageFactory::open(data, size);
- }
Expand|Select|Wrap|Line Numbers
- Image::AutoPtr ImageFactory::open(const byte* data, long size)
- {
- /// code
- }
Any help is appreciated.
Thanks