Possibly related to Unmanaged C# calls to a static library by https://stackoverflow.com/users/456434/mazyod
I'm trying to build an iOS app using the HoloToolkit.Sharing library (https://github.com/Microsoft/MixedRealityToolkit/tree/master/Sharing) which is in turn based on several open source components including RakNet.
After building the library and its dependencies as static libraries for arm64, and manually changing the DLL references to __Internal, I am able to load the plugin in iOS but the app throws an exception:
EntryPointNotFoundException: SWIGRegisterExceptionCallbacks_SharingClient
HoloToolkit.Sharing.SharingClientPINVOKE+SWIGExceptionHelper..cctor () (at Assets/HoloToolkit/Sharing/Scripts/SDK/SharingClientPINVOKE.cs:150)
The wrapper looks like this:
[global::System.Runtime.InteropServices.DllImport ("__Internal", EntryPoint = "SWIGRegisterExceptionCallbacks_SharingClient")]
public static extern void SWIGRegisterExceptionCallbacks_SharingClient (
ExceptionDelegate applicationDelegate,
ExceptionDelegate arithmeticDelegate,
ExceptionDelegate divideByZeroDelegate,
ExceptionDelegate indexOutOfRangeDelegate,
ExceptionDelegate invalidCastDelegate,
ExceptionDelegate invalidOperationDelegate,
ExceptionDelegate ioDelegate,
ExceptionDelegate nullReferenceDelegate,
ExceptionDelegate outOfMemoryDelegate,
ExceptionDelegate overflowDelegate,
ExceptionDelegate systemExceptionDelegate);
As far as I can tell, the necessary wrappers from swig are also included in the C++ project (found in ClientWrapperAPI_CSharp.cpp):
#ifdef __cplusplus
extern "C"
#endif
SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_SharingClient(
SWIG_CSharpExceptionCallback_t applicationCallback,
SWIG_CSharpExceptionCallback_t arithmeticCallback,
SWIG_CSharpExceptionCallback_t divideByZeroCallback,
SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback,
SWIG_CSharpExceptionCallback_t invalidCastCallback,
SWIG_CSharpExceptionCallback_t invalidOperationCallback,
SWIG_CSharpExceptionCallback_t ioCallback,
SWIG_CSharpExceptionCallback_t nullReferenceCallback,
SWIG_CSharpExceptionCallback_t outOfMemoryCallback,
SWIG_CSharpExceptionCallback_t overflowCallback,
SWIG_CSharpExceptionCallback_t systemCallback) {
SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
}
Building with IL2CPP and .NET 2.0 Subset, using -unsafe flag in Unity 5.5.2f1 64-bit on Mac OS X 10.12, Xcode 9.0 beta 2, iOS 11 beta.
Is there something else I need to change to get the __Internal reference to work? Or, is there's something else needed for the wrapper to find the callback (I found this very old thread mentioning the need to build a "helper dll": http://swig.10945.n7.nabble.com/C-wrapper-tries-to-find-SWIGRegisterExceptionCallbacks-MyDLL-td6935.html)?