I have 2 C++ DLLs. One of them contains the following function:
void init(const unsigned char* initData, const unsigned char* key)
The other one contains this function:
BYTE* encrypt(BYTE *inOut, UINT inputSize, BYTE *secretKey, UINT secretKeySize).
Is there a way to call these 2 functions from C#? I know you can use [DllImport] in C# to call C++ functions, but the pointers are giving me a hard time.
Any help would be appreciated!
Yes, you can call both of these from C# assuming that they are wrapped in extern "C" sections. I can't give you a detailed PInvoke signature because I don't have enough information on how the various parameters are related but the following will work.
Pieces of information that would allow us to create a better signature
For pointers, what you want to use is IntPtr.
For classes, you don't need to do anything special. For value types, you need to use the ref keyword.
MSDN has an article that summarizes this: http://msdn.microsoft.com/en-us/library/awbckfbz.aspx