Home > Net >  C # call c function type conversion problem
C # call c function type conversion problem

Time:04-08

C + + function partial implementation
Bool WINAPI test (uchar * outData, char * outResult)
{
STD: : string strResult="XXXXX"
OutResult=(char *) CoTaskMemAlloc (strResult. The size () + 1);
StrResult. Copy (outResult strResult), size (), 0).
* (outResult + strResult. The size ())='\ 0';
}
In the c # how to call this function to get the string in the outResult, I tried IntPtr and StringBuilder are not, or whether the c + + functions need to be modified

CodePudding user response:

Ref intptr
Have a look, not in the other ways to

Or post before, how to call depends on how to write c + +, rather than the light to see a function declaration, distributing the Pointers and memory are changed here

CodePudding user response:

https://blog.csdn.net/Koupoo/article/details/7844887

Here is the corresponding instructions

CodePudding user response:

Upstairs truth!!!!!!

CodePudding user response:

C + + function declarations with mark

Extern "C" bool WINAPI test (uchar * outData, char * outResult)
  •  Tags:  
  • C#
  • Related