- Home /
Trying to get value from unmanaged memory
Hello everyone.
I'm working on my Unity project with teamspeak and I have to retrieve some id. I have to transfert my id from a unmanaged memory to managed one (with Marshalling) .
So I have this snipset of code :
anyID **list = NULL; list = (anyID**)malloc(sizeof(anyID));
error = Ts3client.ts3client_getClientList(scHandlerID,ref list);
if(error != public_errors.ERROR_ok)
Debug.Log("error client list");
string test = Marshal.PtrToStringAnsi(list);
with :
unsigned intts3client_getClientList(serverConnectionHandlerID, result);
uint64 serverConnectionHandlerID;
anyID** result;
I have compiler error that's saying : Pointers and fixed size buffers may only be used in an unsafe context
Do you have an idea how can I fix this ? Thanks a lot guys
Answer by Statement · Apr 05, 2011 at 12:29 PM
Yeah, Unity3D allows only safe code. Pointers are considered unsafe code.
Write a wrapper with interop http://msdn.microsoft.com/en-us/library/e59b22c5(v=VS.90).aspx
Your answer
Follow this Question
Related Questions
pinning in the memory 2 Answers
Delegates in the Inspector 1 Answer
Windows 8 / Store App: Inputs (WM_POINTER) 0 Answers
Alternative for non-existing EventSystem.IPointerOverHandler 1 Answer
Make an object's rotate by comparing it to a parameter 1 Answer