Marshalling BSTRs from C++ to C# with COM interop

前端 未结 3 857
遇见更好的自我
遇见更好的自我 2021-01-12 16:30

I have an out-of-process COM server written in C++, which is called by some C# client code. A method on one of the server\'s interfaces returns a large BSTR to the client, a

3条回答
  •  情书的邮戳
    2021-01-12 17:13

    I guess you need to destroy request with ::SysFreeString(). This memory is allocated on server side.

    Also, OLE2A may allocate memory due to conversion (take a look). You do not free it also.

提交回复
热议问题