Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

[MonoTouch][Bass.dll] Application crash "Attempting to JIT compile method .. while running with --aot-only"

I faced a problem, that I can't solved for 3 days and you're my last hope.

My goal is to record sound with Bass.dll (there's special version of library for iPhone and version of .net wrapper for it; can be found here: un4seen.com)

On simulator program works (or seems to work properly). But when I tried to run it on the iPhone - I got this error:

"Attempting to JIT compile method '(wrapper native-to-managed) RecordingAudioHelloWorld.Player:recordingHandler (int,intptr,int,intptr)' while running with --aot-only."

error happens 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 assemblies only", but it has no effect.

Is there anything that I could do with it?

like image 313
Konstantin Loginov Avatar asked Sep 09 '12 14:09

Konstantin Loginov


1 Answers

Try to add the MonoPInvokeCallback attribute to your recordingHandler function. Note that you also need to make the function static. YourDelegateType should be the delegate type you defined in C# that corresponds to the signature of this method.

[MonoPInvokeCallback (typeof(YourDelegateType)]
private static int recordingHandler (int handle, IntPtr buffer, int length, IntPtr user)
{
// ...
}
like image 135
Rolf Bjarne Kvinge Avatar answered Dec 16 '22 11:12

Rolf Bjarne Kvinge