The eventual long-term plan is to wrap some existing native libraries with C# wrappers, but for now I am just trying to write a simple library in Xcode and use it from a Xamarin iOS project. I am reasonably competent on the windows/c# side but am fairly new to Mac, iOS, and Xamarin, so my problem likely lies somewhere in my lack of experience. On the C/XCode side, I have a simple .h and .cpp file that defines the following function:
extern "C" int __stdcall TestExport()
and on the C#/Xamarin side, I bind it with:
public static class Tests
[DllImport ("__Internal",EntryPoint="TestExport",CallingConvention = CallingConvention.StdCall)]
public extern static int TestExport();
The only thing different in this from a working windows project is the change to "__Internal" from the dll name, and the lack of __declspec(dllexport) on the C side, which I do not see an equivalent for, so I have assumed it isn't needed.
I am getting a System.EntryPointNotFound exception, which should indicate that the lib is being loaded correctly, but the actual function name is not found.
Other notes: I am using the lipo with makefile as specified in the tutorials to build both i386 and arm versions of the lib and lipo-ing them together. I have also tried both adding the lib as a link and with deleting and adding a copy of the lib to no avail. I do not currently know of a tool equivalent to dumpbin that might show me the names available in the lib, so I'm not sure if it's a problem on the export side or on the import side.
Thanks for any help.