- Home /
Crash when calling Marshal.StructureToPtr()
Hello Unity community, I have added a c++ plugin (which I have coded) successfully to a Unity project. I am now attempting to pass a structure to another function within this dll with no success. When the Unity script code reaches the following line:
IntPtr p_mystruct = Marshal.AllocHGlobal(iSizeOfStruct);
Unity simply crashes with the following error:
*0x00007FFA99E4CD37 (mono) [c:\buildslave\mono-runtime-and-classlibs\build\mono\metadata\marshal.c:535] mono_array_to_savearray
ERROR: SymGetSymFromAddr64, GetLastError: 'The specified module could not be found.' (Address: 000000000A302A2E)
ERROR: SymGetModuleInfo64, GetLastError: 'A dynamic link library (DLL) initialisation routine failed.' (Address: 000000000A302A2E)*
A few things about this error:
The path to the mono runtime is incorrect since such a path does not exist on my system.
I tried reinstalling Unity to fix (1) but this did not help (following the instructions on the forum).
The code above works fine in c# (.Net project which is separate from Unity)
I am reaching out to all you Unity experts! Please help (-:
Your answer
![](https://koobas.hobune.stream/wayback/20220612044824im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
C++ native plugin Failed with error '%1 is not a valid Win32 application 0 Answers
DllNotFoundException while using unity native c++ Plugins 0 Answers
How can I get the Native Plugin example to work on Unity 5? 0 Answers
Native Plugin Cleanup 0 Answers
DirectX11 get handle to Unity Swapchain/Backbuffer 0 Answers