jint
shmemBase_initialize(JavaVM *vm, jdwpTransportCallback *cbPtr)
{
    jvm = vm;
    callback = cbPtr;
    tlsIndex = sysTlsAlloc();
    return SYS_OK;
}
Example #2
0
jint JNICALL
jdwpTransport_OnLoad(JavaVM *vm, jdwpTransportCallback* cbTablePtr,
                     jint version, jdwpTransportEnv** result)
{
    if (version != JDWPTRANSPORT_VERSION_1_0) {
        return JNI_EVERSION;
    }
    if (initialized) {
        /*
         * This library doesn't support multiple environments (yet)
         */
        return JNI_EEXIST;
    }
    initialized = JNI_TRUE;

    /* initialize base shared memory system */
   (void) shmemBase_initialize(vm, cbTablePtr);

    /* save callbacks */
    callbacks = cbTablePtr;

    /* initialize interface table */
    interface.GetCapabilities = &shmemGetCapabilities;
    interface.Attach = &shmemAttach;
    interface.StartListening = &shmemStartListening;
    interface.StopListening = &shmemStopListening;
    interface.Accept = &shmemAccept;
    interface.IsOpen = &shmemIsOpen;
    interface.Close = &shmemClose;
    interface.ReadPacket = &shmemReadPacket;
    interface.WritePacket = &shmemWritePacket;
    interface.GetLastError = &shmemGetLastError;
    *result = &single_env;

    /* initialized TLS */
    tlsIndex = sysTlsAlloc();

    return JNI_OK;
}