Am using
Xamarin Studio - 6.1.2 (build 44) Xamarin.iOS Version: 10.2.1.5.
I am trying to binding C "thirdparty.dylib" in my Xamarin.iOS Application. it's a Dynamic library
I have followed https://developer.xamarin.com/guides/ios/advanced_topics/native_interop/
static void Main(string[] args)
{
string fileName = "liba.dylib";
string docfolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
string dbpath = Path.Combine(docfolder, fileName);
var a = ObjCRuntime.Dlfcn.dlopen(dbpath, 0);
if (a == IntPtr.Zero)
{
Console.WriteLine("[FAIL] TestDlopenSystem: Could not dlopen liba.dylib");
}
UIApplication.Main(args, null, "AppDelegate");
}
I have put "liba.dylib" in iOS device internal storage by iTunes but when I try to "ObjCRuntime.Dlfcn.dlopen" "intptr" always return zero
[DllImport("liba.dylib", EntryPoint="foo")]
public static extern double foo();
when I try to use Dllimport its always return DllNotFoundException.
Dylib is not load into memory.