Esempio n. 1
0
int classlibInitialiseNatives() {
    Class *field_accessor;
    FieldBlock *base_fb = NULL;
    char *dll_path = getBootDllPath();
    char *dll_name = getDllName("java");
    char path[strlen(dll_path) + strlen(dll_name) + 2];

    strcat(strcat(strcpy(path, dll_path), "/"), dll_name);
    sysFree(dll_name);

    if(!resolveDll(path, NULL)) {
        jam_fprintf(stderr, "Error initialising natives: couldn't open "
                            "libjava.so: use -verbose:jni for more "
                            "information\n");
        return FALSE;
    }

    field_accessor = findSystemClass0(SYMBOL(
                         sun_reflect_UnsafeStaticFieldAccessorImpl));

    if(field_accessor != NULL)
        base_fb = findField(field_accessor, SYMBOL(base),
                                            SYMBOL(sig_java_lang_Object));

    if(base_fb == NULL) {
        jam_fprintf(stderr, "Error initialising natives: %s "
                            "missing or malformed\n",
                            SYMBOL(sun_reflect_UnsafeStaticFieldAccessorImpl));
        return FALSE;
    }

    hideFieldFromGC(base_fb);

    return initialiseJVMInterface();
}
Esempio n. 2
0
void CBitbases::load(const string& path, int32 cachesize, ELoadType type)
{
    unload();

    if (eLoadNone != type)
    {
        if (m_lib.load(getDllName(path)))
        {
            m_path = path;
            m_cachesize = cachesize;
            m_type = type;

            string bb_path = CFile::correctPath(path);
            m_lib.load_egbb(bb_path.c_str(), m_cachesize * 1024 * 1024, MAP_LOADTYPE[m_type]);
        }
    }
}