Ejemplo n.º 1
0
    /**
     * Register a callback function for a particular string.
     *
     * @param charPtr a C char* with the name of the callback
     * @param fnPtr the function pointer that implements the callback
     *
     * @return the callback id
     */
    public static int registerCallback(int charPtr, int fnPtr)
    {
        String name = CRunTime.charPtrToString(charPtr);
        int    id   = (int)CRunTime.callbacksByName[name];
        int    old  = (int)CRunTime.objectRepository[id];

        CRunTime.objectRepository[id] = fnPtr;     /* Replace with the fn ptr */

        return(old);
    }