In addition to the dispatcher routine identifier mappings, the hlprodsp.c file contains the following functions which support HLC calls from the PAS for OpenEdge multi-session agent:
  • proHLC_IsThreadSafe—A multi-session agent uses the value returned by this function at run time to decide whether calls to the HLC library (prohlc.dll\libprohlc.so) are serialized. If your code is thread safe, proHLC_IsThreadSafe() returns 1. If your code is not thread safe, the function returns 0, in which case the multi-session agent serializes calls to the HLC library. Set the value accordingly in the hlprodsp.c file.
  • proHLC_InitSession()—This function is called after the HLC library is loaded and initialized. For a single-threaded ABL client, this function is called only once immediately after the library is loaded. For a multi-session agent, the function is called once for each ABL session immediately after the first HLC call is made from within an ABL session. If the custom C code is declared to be thread safe—that is, if proHLC_IsThreadSafe() is set to 1, proHLC_InitSession() allocates a structure to store the non-constant global variables of the code and saves the structure in the current ABL session by calling proSetGlobalStruct().

    The following is an example of using proHLC_InitSession():

    {
        void *ptr = promalloc(sizeof(struct myglobaldata));
        /* initialize myglobaldata structure with your non-constant */
        /* global data that you need access to for this ABL Session */
        proSetGlobalStruct(ptr); /* stash it so we can get it later */
    }
    
    Note: Use struct myglobaldata to declare the non-constant global variables to which you need access in an ABL session where myglobaldata is a user-defined name of the structure.
  • proHLC_ExitSession()—This function is called at the end of the ABL session to release the structure allocated in the proHLC_InitSession() function call.

    The following is an example of using proHLC_ExitSession():

    {
        struct myglobaldata *ptr = (void *)proGetGlobalStruct();
        /* First you should deallocate any allocated memory from myglobaldata */
        if (ptr)
            profree((void *)ptr); /* free up the structure itself */
        proSetGlobalStruct((void *) 0); /* so we don’t dereference */
    }