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

StackOverflow https://stackoverflow.com/questions/12340113

質問

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?

役に立ちましたか?

解決

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)
{
// ...
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top