sidharthrshah
asked on
Calling c++ method from .net
I have a decompression algorithm in C++. I want to call the decompression method from .net C# program.
I have successfully created a dummy method in c++, created a dll from that code and added to the c# project file and successfully called that code.
However with this method I am not able to identify what parameters to pass and how.
The c++ decompress method definition is as follows:
-------------------------- ---------- ---------- ---------- ---------- --------
lzo1z_decompress ( const lzo_byte *src, short src_len,
lzo_byte *dst, unsigned int dst_len,
lzo_voidp wrkmem /* NOT USED */ );
-------------------------- ---------- ---------- ---------- ---------- ----------
where
-------------------------- ---------- ---------- ---------- ---------- ---------
#define lzo_byte unsigned char __LZO_MMODEL
#define lzo_voidp void __LZO_MMODEL *
-------------------------- ---------- ---------- ---------- ---------- ----------
and the method call is as follows:
rCode = lzo1z_decompress(BcastCmpP acket.cCom pData , cLen , rbuff , &oLen , &eCode);
On C# side:
I have a byte[] of compressed data to be passed on to the c++ code
and if possible the returning data should also be in the form of byte[]
I require your help on the code to be written on both the c# side and c++ side.
Thanks in advance.
I have successfully created a dummy method in c++, created a dll from that code and added to the c# project file and successfully called that code.
However with this method I am not able to identify what parameters to pass and how.
The c++ decompress method definition is as follows:
--------------------------
lzo1z_decompress ( const lzo_byte *src, short src_len,
lzo_byte *dst, unsigned int dst_len,
lzo_voidp wrkmem /* NOT USED */ );
--------------------------
where
--------------------------
#define lzo_byte unsigned char __LZO_MMODEL
#define lzo_voidp void __LZO_MMODEL *
--------------------------
and the method call is as follows:
rCode = lzo1z_decompress(BcastCmpP
On C# side:
I have a byte[] of compressed data to be passed on to the c++ code
and if possible the returning data should also be in the form of byte[]
I require your help on the code to be written on both the c# side and c++ side.
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER