【问题标题】:[MonoTouch][Bass.dll] Application crash "Attempting to JIT compile method .. while running with --aot-only"[MonoTouch][Bass.dll] 应用程序崩溃“尝试 JIT 编译方法 .. 同时使用 --aot-only 运行”
【发布时间】:2012-09-02 15:16:24
【问题描述】:

我遇到了一个问题,我 3 天都无法解决,而你是我最后的希望。

我的目标是用 Bass.dll 录制声音(有 iPhone 的特殊版本库和 .net 包装器版本;可以在这里找到:un4seen.com)

模拟器程序工作(或似乎工作正常)。但是当我尝试在 iPhone 上运行它时 - 我收到了这个错误:

“在使用 --aot-only 运行时尝试 JIT 编译方法 '(wrapper native-to-managed) RecordingAudioHelloWorld.Player:recordingHandler (int,intptr,int,intptr)'。”

错误发生在这里:

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)
{
//....
}

正如我在此处阅读的那样,我将链接器行为更改为“仅链接 SDK 程序集”,但它没有任何效果。

有什么我可以用它做的吗?

【问题讨论】:

    标签: ios xamarin.ios jit aot bass


    【解决方案1】:

    尝试将MonoPInvokeCallback 属性添加到您的recordingHandler 函数中。请注意,您还需要将函数设为静态。 YourDelegateType 应该是您在 C# 中定义的与此方法的签名相对应的委托类型。

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

    【讨论】:

    • 添加后 [MonoPInvokeCallbackAttribute(typeof(_Ov_fopen))] [DllImport("__Internal", CallingConvention = CallingConvention.Cdecl, EntryPoint = "ov_fopen")] public static extern unsafe int ov_fopen([In() ] [MarshalAs(UnmanagedType.LPStr)] 字符串路径,参考文件 vf);委托: [UnmanagedFunctionPointer(CallingConvention.StdCall)] 委托 int _Ov_fopen(string path,ref File file);给我另一个错误Error MT3001: Could not AOT the assembly '/XXX/obj/iPhone/Debug/build-iphone5.2-8.1.1/mtouch-cache/Build/BindingLibrary.dll' (MT3001)@Rolf Bjarne Kvinge
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多