[MonoTouch] [Bass.dll] Application failed "Attempted to use the JIT .. compilation method when working with --aot-only"

I have a problem that I can’t solve in 3 days, and you are my last hope.

My goal is to record sound using Bass.dll (there is a special version of the library for the iPhone and a version of the .net shell for it, can be found here: un4seen.com)

In the program, the simulator works (or seems to work correctly). But when I tried to run it on the iPhone, I got this error:

"Attempting the JIT compilation method" (Russian-language wrapper) RecordingAudioHelloWorld.Player: record Handler (int, intptr, int, intptr) 'when working with -aot-only.

The error is here:

RECORDPROC _recordingHandler = new RECORDPROC(recordingHandler); _record = Bass.BASS_RecordStart(16000, 1, BASSFlag.BASS_SPEAKER_RIGHT, _recordingHandler, IntPtr.Zero); // <-- ERROR!!! private int recordingHandler (int handle, IntPtr buffer, int length, IntPtr user) { //.... } 

As I read here on SO, I changed Linker behavior to "Link SDK assemblysies only", but it has no effect.

Is there anything I could do about this?

+4
source share
1 answer

Try adding the MonoPInvokeCallback attribute to the recordHandler function. Please note that you also need to make the function static. YourDelegateType must be the type of delegate that you defined in C # that matches the signature of this method.

 [MonoPInvokeCallback (typeof(YourDelegateType)] private static int recordingHandler (int handle, IntPtr buffer, int length, IntPtr user) { // ... } 
+5
source

Source: https://habr.com/ru/post/1433235/


All Articles