Call a C++ function from C#

前端 未结 4 1018
醉梦人生
醉梦人生 2020-12-18 11:17

I have 2 C++ DLLs. One of them contains the following function:

void init(const unsigned char* initData, const unsigned char* key)

The othe

4条回答
  •  -上瘾入骨i
    2020-12-18 12:07

    [DllImport("yourdll.dll")]
    static extern void init([MarshalAs(UnmanagedType.LPArray)] byte[] initData, [MarshalAs(UnmanagedType.LPArray)] byte[] key);
    
    [DllImport("yourdll.dll")]
    static extern IntPtr encrypt([MarshalAs(UnmanagedType.LPArray)] byte[] inOut, int inputSize, [MarshalAs(UnmanagedType.LPArray)] byte[] key, int secretKeySize);
    

提交回复
热议问题