- Home /
How can I pass pointers to DLL functions?
Hi,
How should I pass pointers to functions like this in unity:
[DllImport("KING.DLL", CallingConvention = CallingConvention.Cdecl)]
unsafe public static extern int Start(String Product, String CD, byte* Sys, uint BufferSize);
private int Check()
{
int i = -203;
unsafe
{
byte* str = (byte*)Marshal.AllocCoTaskMem(4);
try
{
StringBuilder strOut = new StringBuilder(" ");
String Result;
string strPK = "0F4E3B12";
i = Start(strPK, "METHODE2WITHHDCS", str, 4);
}
catch (Exception ex)
{ i = -202; }
Marshal.FreeCoTaskMem((IntPtr)str);
}
return i;
}
Thanks in advance.
Comment
Your answer
Follow this Question
Related Questions
Using a fixed size pointer in Unity C# with a C++ external function 0 Answers
Is it possible to pass references to structures containing array of references as from C# to C dll? 0 Answers
Unsafe unity 5.4 up not working (Kinect V2 getting BodyIndex) ? 0 Answers
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers