static int bb_unload(struct soap_session *ps) { unload_library(ps->bb_handle); ps->bb_handle = NULL; unload_library(ps->hpmud_handle); ps->hpmud_handle = NULL; unload_library(ps->math_handle); ps->math_handle = NULL; return 0; } /* bb_unload */
DRIVER_ERROR ModeJpeg::Init(int color_mode, int band_height, COMPRESS_MODE *eCompressMode, QTableInfo *qtable_info) { DRIVER_ERROR err; m_iColorMode = color_mode; m_pQTableInfo = qtable_info; int buf_size = band_height * m_iRowWidth; err = Init(buf_size, band_height); if (err != NO_ERROR) { return err; } // If plugin is not available or the plugin does not contain Taos compressor, stay with JPEG compression m_eCompressor = COMPRESSOR_JPEG_JETREADY; if (*eCompressMode == COMPRESS_MODE_LJ) { m_hHPLibHandle = load_plugin_library(UTILS_PRINT_PLUGIN_LIBRARY, PRNT_PLUGIN_LJ); if (m_hHPLibHandle) { dlerror (); *(void **) (&HPLJJRCompress) = get_library_symbol(m_hHPLibHandle, "HPJetReadyCompress"); if (HPLJJRCompress == NULL) { unload_library(m_hHPLibHandle); m_hHPLibHandle = NULL; *eCompressMode = COMPRESS_MODE_JPEG; } else { m_eCompressor = COMPRESSOR_TAOS; } } } return err; }
void free_winlibrary(WinLibrary *fl) { unload_library(fl); if (fl->file) fclose(fl->file); free(fl->name); }
int android_dlclose(void *handle) { pthread_mutex_lock(&dl_lock); (void)unload_library((soinfo*)handle); pthread_mutex_unlock(&dl_lock); return 0; }
/* * If we've loaded a library containing Scorpio bitbase code, unload it. */ void unload_scorpio_bb(void) { if (!lib) return; unload_library(lib); lib = NULL; egbb_is_loaded = false; }
void load_library() { if (handle_ != NULL) unload_library(); handle_ = LoadLibrary(module_.native().c_str()); if (handle_ == NULL) throw dll_exception("Could not load library: " + utf8::cvt<std::string>(error::lookup::last_error()) + ": " + module_.filename().string()); }
int export_dl_close(int lib, unsigned flags) { (void)(flags); return unload_library(lib); }
ModeJpeg::~ModeJpeg() { unload_library(m_hHPLibHandle); if (m_pbyInputBuffer) { delete [] m_pbyInputBuffer; } }
ModeJbig::~ModeJbig() { unload_library(m_hHPLibHandle); if (m_pszInputRasterData) { delete [] m_pszInputRasterData; } }
int android_dlclose(void *handle) { if (is_builtin_lib_handle(handle)) return 0; pthread_mutex_lock(&dl_lock); (void)unload_library((soinfo*)handle); pthread_mutex_unlock(&dl_lock); return 0; }
int __wrap_dlclose(void *handle) { if (extractLibs) return dlclose(handle); pthread_mutex_lock(&dl_lock); (void)unload_library((soinfo*)handle); pthread_mutex_unlock(&dl_lock); return 0; }
int __libc_dlclose (void *map) { int *dl = (int*)map; if( dl == NULL ) return EINVAL; unload_library( *dl ); free( map ); return 0; }
int dlclose(void *handle) { int dl = (int)handle; if( dl == 0 ) { __dl_set_errno( _DL_EBADHANDLE ); return( EINVAL ); } unload_library( dl ); return( 0 ); }
void release_ffi_table (bytecode_t *bc) { if (bc->ffi_table != NULL) { FFI_TABLE_ENTRY *table = bc->ffi_table; LIB_HANDLE *libs = (LIB_HANDLE *) bc->dll_handles; int n_symbols = bc->ffi_table_length; int i; if (table != NULL) { for (i = 0; i < n_symbols; ++i) { free (table[i].name); } free (table); } if (libs != NULL) { for (i = 0; libs[i] != NULL; ++i) { unload_library (libs[i]); } free (libs); } } }
/* * Load Scorpio bitbases from |egbb_dir|, with the specified cache size. * We also need to find a compatible shared library in the directory. */ bool load_scorpio_bb(char* egbb_dir, int cache_size_bytes) { if (!cache_size_bytes) cache_size_bytes = EGBB_DEFAULT_CACHE_SIZE; char path[1024]; egbb_is_loaded = false; if (lib) unload_library(lib); strncpy(path, egbb_dir, 1000); strcat(path, EGBB_NAME); lib = load_library(path); if (!lib) { strncpy(path, egbb_dir, 1000); strcat(path, EGBB_NAME2); lib = load_library(path); } if (!lib) { strncpy(path, egbb_dir, 1000); strcat(path, EGBB64_NAME); lib = load_library(path); } if (!lib) { strncpy(path, egbb_dir, 1000); strcat(path, EGBB64_NAME2); lib = load_library(path); } if (!lib) { printf("info string Failed to load egbb from %s.\n", egbb_dir); return false; } load_egbb_fn load_egbb = (load_egbb_fn)load_function(lib, "load_egbb_5men"); probe_egbb_internal = (probe_egbb_fn)load_function(lib, "probe_egbb_5men"); load_egbb(egbb_dir, cache_size_bytes, SMART_LOAD); egbb_is_loaded = true; return true; }
static status_t export_unload_library(void* handle) { return unload_library(handle, -1, false); }
int build_ffi_table (bytecode_t *bc) { FFI_TABLE_ENTRY *table = NULL; LIB_HANDLE *libs = NULL; tbc_ffi_t *ffi = bc->tbc->ffi; char **lib_names = NULL; int n_libs = 0; tenc_str_t *str; int i; bc->ffi_table = NULL; bc->ffi_table_length = 0; bc->dll_handles = NULL; if (ffi == NULL) return 1; if (ffi->n_symbols <= 0) return 1; /* Load libraries */ for (str = ffi->libraries; str != NULL; str = str->next) { if (str->str == NULL) break; n_libs++; } libs = (LIB_HANDLE *) malloc (sizeof (LIB_HANDLE) * (n_libs + 1)); lib_names = (char **) malloc (sizeof (char *) * n_libs); for (i = 0, str = ffi->libraries; i < n_libs; ++i, str = str->next) { LIB_HANDLE *lib = load_library (str->str); if (lib != NULL) { libs[i] = lib; lib_names[i] = str->str; } else { fprintf (stderr, "Failed to open library %s: %s\n", str->str, library_error_str() ); goto errout; } } libs[n_libs] = NULL; /* Build FFI table */ table = malloc (sizeof (FFI_TABLE_ENTRY) * ffi->n_symbols); for (i = 0; i < ffi->n_symbols; ++i) { table[i].func = NULL; table[i].name = NULL; } for (i = 0; i < ffi->n_symbols; ++i) { char *name = ffi->map[i].symbol; void *sym = NULL; int lib_n = ffi->map[i].library; if ((lib_n >= 0) && (lib_n < n_libs)) { sym = get_symbol (libs[lib_n], name); if (sym == NULL) { fprintf (stderr, "Unable to find symbol '%s' in library '%s'.\n", name, lib_names[lib_n] ); } } else { for (lib_n = 0; lib_n < n_libs; ++lib_n) { if ((sym = get_symbol (libs[lib_n], name)) != NULL) break; } if (sym == NULL) { fprintf (stderr, "Unable to find symbol '%s'.\n", name ); } } if (sym != NULL) { int lib_len = strlen (lib_names[lib_n]); int name_len = strlen (name); table[i].func = (FFI_FUNCTION) sym; table[i].name = malloc (lib_len + name_len + 2); sprintf (table[i].name, "%s:%s", lib_names[lib_n], name); } else { goto errout; } } bc->ffi_table = table; bc->ffi_table_length = ffi->n_symbols; bc->dll_handles = (void *) libs; free (lib_names); return ffi->n_symbols; errout: if (table != NULL) { for (i = 0; i < ffi->n_symbols; ++i) { if (table[i].name != NULL) free (table[i].name); } free (table); } if (libs != NULL) { for (i = 0; i < n_libs; ++i) { if (libs[i] != NULL) unload_library (libs[i]); } free (libs); free (lib_names); } return 0; }
static status_t export_unload_add_on(image_id id) { return unload_library(NULL, id, true); }