[][src]Function dqcsim::bindings::dqcs_pdef_set_initialize_cb

#[no_mangle]pub extern "C" fn dqcs_pdef_set_initialize_cb(
    pdef: dqcs_handle_t,
    callback: Option<extern "C" fn(user_data: *mut c_void, state: dqcs_plugin_state_t, init_cmds: dqcs_handle_t) -> dqcs_return_t>,
    user_free: Option<extern "C" fn(user_data: *mut c_void)>,
    user_data: *mut c_void
) -> dqcs_return_t

Sets the user logic initialization callback.

This is always called before any of the other callbacks are run. The downstream plugin has already been initialized at this stage, so it is legal to send it commands.

The default behavior is no-op.

Besides the common arguments, the callback receives a handle to an ArbCmd queue (dqcs_cq_*, dqcs_cmd_*, and dqcs_arb_* interfaces) containing user-defined initialization commands. This is a borrowed handle; the caller will delete it.

The callback can return an error by setting an error message using dqcs_error_set() and returning DQCS_FAILURE. Otherwise, it should return DQCS_SUCCESS.