How to use a C callback from C#?

后端 未结 1 1386
予麋鹿
予麋鹿 2021-01-28 05:56

This is a .NET wrapper for the library Secret Rabbit Code (aka libsamplerate), when calling src_callback_read in CallbackRead : AccessViola

相关标签:
1条回答
  • 2021-01-28 06:37

    I have fixed it using the following :

    [System::Runtime::InteropServices::UnmanagedFunctionPointerAttribute ( CallingConvention::Cdecl )]
    public delegate long SRCCallback ( void *cb_data, float **data ) ;
    
    static  IntPtr CallbackNew ( SRCCallback ^ % func, RabbitConverter converter_type, int channels, int *error, void* cb_data ) { ... }
    

    In short : now it uses C calling convention and C# ref keyword.

    0 讨论(0)
提交回复
热议问题