예제 #1
0
void egbb_init(void) {

   // init

   Egbb->init = false;
   Egbb->load = false;
   Egbb->size = CacheSize;
   Egbb->piece_nb = 0;
   Egbb->read_hit = 0;
   Egbb->read_nb = 0;

   LibHandler = LOAD_LIB(EgbbLib);

   if (LibHandler != NULL) {

      send("egbb library loaded");

      load_egbb_ptr =    (load_egbb_5men)     GET_ENTRY(LibHandler,"load_egbb_5men");
      probe_egbb_ptr =   (probe_egbb_5men)    GET_ENTRY(LibHandler,"probe_egbb_5men");

      if (load_egbb_ptr == NULL)   my_fatal("egbb_init(): load_egbb_5men() not found\n");
      if (probe_egbb_ptr == NULL)  my_fatal("egbb_init(): probe_egbb_5men() not found\n");

      Egbb->init = true;
   }
}
예제 #2
0
  // load one specific plugin
  bool Plugins::load_plugin (const string& path)
  {

    typedef const char* (*__plugin_version__)(void);
    typedef Sass_Function_List (*__plugin_load_fns__)(void);
    typedef Sass_Importer_List (*__plugin_load_imps__)(void);

    if (LOAD_LIB(plugin, path))
    {
      // try to load initial function to query libsass version suppor
      if (LOAD_LIB_FN(__plugin_version__, plugin_version, "libsass_get_version"))
      {
        // get the libsass version of the plugin
        if (!compatibility(plugin_version())) return false;
        // try to get import address for "libsass_load_functions"
        if (LOAD_LIB_FN(__plugin_load_fns__, plugin_load_functions, "libsass_load_functions"))
        {
          Sass_Function_List fns = plugin_load_functions();
          while (fns && *fns) { functions.push_back(*fns); ++ fns; }
        }
        // try to get import address for "libsass_load_importers"
        if (LOAD_LIB_FN(__plugin_load_imps__, plugin_load_importers, "libsass_load_importers"))
        {
          Sass_Importer_List imps = plugin_load_importers();
          while (imps && *imps) { importers.push_back(*imps); ++ imps; }
        }
        // try to get import address for "libsass_load_headers"
        if (LOAD_LIB_FN(__plugin_load_imps__, plugin_load_headers, "libsass_load_headers"))
        {
          Sass_Importer_List imps = plugin_load_headers();
          while (imps && *imps) { headers.push_back(*imps); ++ imps; }
        }
        // success
        return true;
      }
      else
      {
        // print debug message to stderr (should not happen)
        cerr << "failed loading 'libsass_support' in <" << path << ">" << endl;
        if (const char* dlsym_error = dlerror()) cerr << dlsym_error << endl;
        CLOSE_LIB(plugin);
      }
    }
    else
    {
      // print debug message to stderr (should not happen)
      cerr << "failed loading plugin <" << path << ">" << endl;
      if (const char* dlopen_error = dlerror()) cerr << dlopen_error << endl;
    }

    return false;

  }
JNIEXPORT void JNICALL Java_org_apache_harmony_awt_nativebridge_windows_WGL_init (JNIEnv * env, jclass cls) {
    LOAD_LIB(libOpenGL32, "OpenGL32");
    INIT_GL_GET_PROC_ADDRESS
}
JNIEXPORT void JNICALL Java_org_apache_harmony_awt_gl_opengl_GL_init (JNIEnv * env, jclass cls) {
    LOAD_LIB(libGL, GL);
    LOAD_LIB(libGLU, GLU);
    INIT_GL_GET_PROC_ADDRESS
}
JNIEXPORT void JNICALL Java_org_apache_harmony_awt_nativebridge_linux_Xft_init (JNIEnv * env, jclass cls) {
    LOAD_LIB(libXft, Xft);
    XInitThreads();
    XSetErrorHandler(errorHandler);
}