0

I have C code where is method defines like this:

//! Definition of the verify appliance notification function.
typedef void (STDCALL *pfNotifyVerifyAppliance)(mdp_sdk_handle_t handle, const char* hostname, bool is_verified, const availableappliance_t* appliance, void* context);
//! Function to specify a function that should be called when an available appliance is verified. Appliance is only valid when is_verified is true.
EXTERN void STDCALL mdp_sdk_notify_verify_appliance(mdp_sdk_handle_t handle, pfNotifyVerifyAppliance NotifyVerifyAppliance);

The NotifyVerifyAppliance is in C code sample a function callback like this:

static void STDCALL NotifyVerifyAppliance(mdp_sdk_handle_t handle, const char* hostname, bool is_verified, const availableappliance_t* appliance, void* context)
{
...
}

I have generated Java wrapper for the function and the generated callback class looks like this:

public class SWIGTYPE_p_f_p_struct_mdp_sdk_handle_dummystruct_p_q_const__char_bool_p_q_const__availableappliance_t_p_void__void {
  private transient long swigCPtr;

  protected SWIGTYPE_p_f_p_struct_mdp_sdk_handle_dummystruct_p_q_const__char_bool_p_q_const__availableappliance_t_p_void__void(long cPtr, @SuppressWarnings("unused") boolean futureUse) {
    swigCPtr = cPtr;
  }

  protected SWIGTYPE_p_f_p_struct_mdp_sdk_handle_dummystruct_p_q_const__char_bool_p_q_const__availableappliance_t_p_void__void() {
    swigCPtr = 0;
  }

  protected static long getCPtr(SWIGTYPE_p_f_p_struct_mdp_sdk_handle_dummystruct_p_q_const__char_bool_p_q_const__availableappliance_t_p_void__void obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }
}

My callback class is instantiated but I do not know to to access data. There are no arguments that original callback C method gets. How should I improve Swig generation to get this?

Skoky
  • 849
  • 1
  • 9
  • 15
  • check out this: http://stackoverflow.com/a/20556147/4758618 as it is relevant to your question. – V-master Oct 12 '15 at 06:57
  • Yes, but "director" feature is only available for C++ in Swig. I need this to be working with C code. Any idea? – Skoky Oct 12 '15 at 09:42

0 Answers0