Search code examples
c#androidmonodevelopdllnotfoundexception

Where should I place the dll file when I use DLLImport?


I know that in windows forms you just need to place the file in the Debug folder, but it seems that it is totally different in monodev for android. I have tried placing the file from assets folder, adding reference paths, setting reference folders from project settings etc. but I still do not get any luck. I always get a DLLNotFoundException .

Also, below is the code for importing the dll file

[DllImport("testing.dll", EntryPoint = "Testing_Open", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
 public static extern uint Testing_Open(HINSTANCE hInstance);

Solution

  • You can't DllImport .dll's on Mono for Android because it is a Linux-based system, not a Windows-based system. You'll need to DllImport a Linux shared library (*.so).