- Home /
Mono build works but IL2CPP throws error.
Hello, i'm using microsoft onnxruntime with unity. When i build for android with mono, it works great but if i change it to il2cpp, following error happens:
MarshalDirectiveException: Cannot marshal P/Invoke call through delegate of type '.DOrtGetApi' at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointerInternal (System.IntPtr ptr, System.Type t) [0x00000] in :0 > at System.Runtime.InteropServices.Marshal.GetDelegateForFunctionPointer > (System.IntPtr ptr, System.Type t) > [0x00000] in > :0 > at Microsoft.ML.OnnxRuntime.NativeMethods..cctor > () [0x00000] in > :0 > at Microsoft.ML.OnnxRuntime.SessionOptions..ctor > () [0x00000] in > :0 > at Microsoft.ML.OnnxRuntime.InferenceSession..ctor > (System.String modelPath) [0x00000] in > :0 > at ML.Predict (UnityEngine.Texture2D framecam) > [0x00000] in > :0 > at CameraFeed.Update () [0x00000] in > :0 > Rethrow as TypeInitializationException: The type > initializer for 'Microsoft.ML.Onnx
Any solution? Thanks.
Answer by bekici · Jan 25 at 10:30 AM
Hi there, Did you find a solution for this issue? I've faced with the same error.