Implementing CallBack Handler

KamranGillKamranGill USMember
edited March 10 in Objective Sharpie

I'm new Xamarin IOS Binding I'm using NabtoClient Framework(https://cocoapods.org/?q=nabto) for creating Binding Library.

On this Method I'm not sure how to create its Callback Function is giving Error as the call back is not defined.

     [DllImport("__Internal")]
     static extern unsafe nabto_status_t nabtoRegisterLogCallback(NabtoLogCallbackFunc callback);

I have Created a Delegate for the Call back

// This declares the callback signature for the block:
delegate void NabtoLogCallbackFunc([MarshalAs(UnmanagedType.LPStr)] string Line, IntPtr size);

by Reviewing the Method Definition But I'm not sure its the correct approach.
/**
* Definition of the callback function for the nabtoRegisterLogCallback
* function. This should use the NABTOAPI calling convention in the future.
* @param line The line to log.
* @param size The length of the line.
/
typedef void (
NabtoLogCallbackFunc)(const char* line , size_t size);

Sign In or Register to comment.