linphone-developers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Linphone-developers] liblinphone method name changes


From: Kamyar Paykhan
Subject: [Linphone-developers] liblinphone method name changes
Date: Sat, 24 Nov 2018 14:48:53 +0330

I am trying to use the liblinphone C# wrapper available in Xamarin SDK and am able to succesfully send-receive various SIP messages to other endpoints.
To be able to use media streaming features of the library, First I tried to get sound devices using `linphone_core_get_sound_devices_list` method. However I got the following error: 
Unable to find an entry point named 'linphone_core_get_sound_devices_list' in DLL 'linphone'
which is pretty self explanatory. In the API documentation, the method name is ` linphone_core_get_sound_devices` (without _list). Same is true for linphone_core_get_supported_file_formats_list and linphone_core_get_video_devices_list. Peeking into linphone.dll (using dumpbin.exe) revealed that signatures are indeed without _list postfix (not sure if this is a breaking change in previous versions of the library).
So I changed the signature and removed the postfix. This time it the method is called successfully and returns a non-zero InPtr value. But when the wrapper tries to marshal the result back to string enumeration (in MarshalStringArray method), I get the following exception:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt

Below is the part that causes the exception:

while (ptr != IntPtr.Zero)
    {
        IntPtr dataPtr = bctbx_list_get_data(ptr);
        if (dataPtr == IntPtr.Zero)
        {
            break;
        }
        string key = Marshal.PtrToStringAuto(dataPtr); // Exception here
        yield return key;
        ptr = bctbx_list_next(ptr);
    }


I'd appreciate if anyone could tell how to fix the issue.
Thank you.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]