theKernel 10.0 NHI1 - theKernel - theLink - theConfig - theSq3Lite - theCompiler - theBrain - theGuard
c - tcl - py - jv - cc
Loading...
Searching...
No Matches
Callback Signature List

List of all callback defined by LibMkKernel

The callback have to be a C proc or method

Callback signature

#define MkObjectDeleteCallF_ARGS MK_RT_ARGS MK_OBJ const obj, MK_CBP const __data__
#define MkObjectDeleteCallF_CALL MK_RT_CALL obj, __data__
#define MkObjectDeleteFreeF_ARGS MK_RT_ARGS MK_CBP *dataP
__parser__(class=MkObjectC,callback-name=ObjectDelete,callback-null)
MK_STRN ident ,
MkObjectDeleteCallF fCall __parser__(callback-call),
MK_CBP callback __parser__(callback-data),
MkObjectDeleteFreeF fFree __parser__(callback-free),
MK_STRN filter __parser__(default=NULL)
Note
For the C-language the fCall is the function called and the callback is the additional data. This is different for the non-C-languges from (C,C++,C#,VB.NET,Java,Python,Ruby,Perl,PHP,Tcl or GO).
For the non-C-language the fCall is internal and the callback is the target-language-callback as data attribute.

Read more about how to define a service-callback in theLink .

Callback example

Example about the delete-callback-setup from the RPC server example/c/LibSq3LiteRpcServer.c

ServerSetup : The DeleteCallback is usually installed in the Setup-Callback but only once.

  if (MQ_IS_SERVER_PARENT(mqctx)) {
    // call “sDeleteCall” ONLY when deleting an instance whose class name matches the regular expression “^Sq3”
    MkObjectDeleteCallbackSetup_E("LibSq3LiteRpcServer", sDeleteCall, mqctx, NULL, "^Sq3");
  }

The DeleteCallback is called before the deletion. In the RPC example, the RPC client is informed about the impending deletion.

static enum MkErrorE sDeleteCall ( MkObjectDeleteCallF_ARGS )
{
  MQ_CTX mqctx = MqCtx(__data__);
  if (mqctx == NULL) return MK_OK;
  return  MqSend(mqctx,"E","%DEL:CCIH", 
            MqConfigGetName(mqctx), MkObjectToNameOfType(obj), MkObjectHandleGetOfType(obj), MkObjectHandleGet(obj)
          );
}

ServerCleanup : If the RPC server is deleted, the DeleteCallback is no longer needed and is therefore also deleted.

  if (MQ_IS_SERVER_PARENT(mqctx)) {
    MkObjectDeleteCallbackCleanup("LibSq3LiteRpcServer");
  }

Callbacks defined by LibMkKernel

Global MkObjectDeleteCallbackSetup_RT (MK_RT const mkrt, MK_STRN ident, MkObjectDeleteCallF fCall, MK_CBP callback, MkObjectDeleteFreeF fFree, MK_STRN filter)
MkObjectDeleteCallbackSetup