The API reference in question is located here.
I need to know how to properly DLLImport and then use this in vb:
const bctbx_list_t* linphone_core_get_calls ( LinphoneCore * lc )
The part I'm having trouble with is the const bctbx_list_t*
return value. I tried declaring the dllimport like this:
<DllImport(LIBNAME, CallingConvention:=CallingConvention.Cdecl)>
Private Shared Function linphone_core_get_calls(lc As IntPtr) As List(Of IntPtr)
End Function
and then using it like this:
Dim CurrentCallList As List(Of IntPtr) = linphone_core_get_calls(_LinPhoneCore)
which compiles but gives me an error:
Cannot marshal 'return value': Generic types cannot be marshaled.
Any help would be greatly appreciated.
Based on GSerg's comment, I went looking for the definition of bctbx_list_t, which I found here. It's a linked list:
typedef struct _bctbx_list {
struct _bctbx_list *next;
struct _bctbx_list *prev;
void *data;
} bctbx_list_t;
I translated that to:
Private Structure _bctbx_list
Public [next] As IntPtr
Public prev As IntPtr
Public data As IntPtr
End Structure
changing the import to:
<DllImport(LIBNAME, CallingConvention:=CallingConvention.Cdecl)>
Private Shared Function linphone_core_get_calls(lc As IntPtr) As _bctbx_list
End Function
And I'm in business.