本文整理汇总了C++中shl_unload函数的典型用法代码示例。如果您正苦于以下问题:C++ shl_unload函数的具体用法?C++ shl_unload怎么用?C++ shl_unload使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shl_unload函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main ()
{
shl_t solib_handle;
int dummy;
int status;
int (*solib_main) (int);
/* Load a shlib, with immediate binding of all symbols.
Note that the pathname of the loaded shlib is assumed to be relative
to the testsuite directory (from whence the tested GDB is run), not
from dot/.
*/
dummy = 1; /* Put some code between shl_ calls... */
solib_handle = shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE, 0);
/* Find a function within the shlib, and call it. */
status = shl_findsym (&solib_handle,
"solib_main",
TYPE_PROCEDURE,
(long *) &solib_main);
status = (*solib_main) (dummy);
/* Unload the shlib. */
status = shl_unload (solib_handle);
/* Load a different shlib, with deferred binding of all symbols. */
dummy = 2;
solib_handle = shl_load ("gdb.base/solib2.sl", BIND_DEFERRED, 0);
/* Find a function within the shlib, and call it. */
status = shl_findsym (&solib_handle,
"solib_main",
TYPE_PROCEDURE,
(long *) &solib_main);
status = (*solib_main) (dummy);
/* Unload the shlib. */
status = shl_unload (solib_handle);
/* Reload the first shlib again, with deferred symbol binding this time. */
dummy = 3;
solib_handle = shl_load ("gdb.base/solib1.sl", BIND_IMMEDIATE, 0);
/* Unload it without trying to find any symbols in it. */
status = shl_unload (solib_handle);
/* All done. */
dummy = -1;
return 0;
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:51,代码来源:solib.c
示例2: ppl_dso_unload
ppl_status_t
ppl_dso_unload (ppl_dso_handle_t * thedso)
{
ppl_dso_handle_t *dso = thedso;
if (dso->handle == NULL)
{
osip_free (dso);
return PPL_SUCCESS;
}
#if defined(DSO_USE_SHL)
shl_unload ((shl_t) dso->handle);
#elif defined(DSO_USE_DYLD)
NSUnLinkModule (dso->handle, FALSE);
#elif defined(DSO_USE_DLFCN)
if (dlclose (dso->handle) != 0)
{
osip_free (dso);
return PPL_EINIT;
}
#endif
dso->handle = NULL;
osip_free (dso);
return PPL_SUCCESS;
}
开发者ID:gozfree,项目名称:src,代码行数:25,代码来源:ppldso.c
示例3: dlclose
int
dlclose(dll_handle h)
{
shl_t hp = *((shl_t *)h);
if (hp != NULL) free(hp);
return shl_unload(h);
}
开发者ID:1ack,项目名称:Impala,代码行数:7,代码来源:dlopen.c
示例4: dl_load
static int dl_load(DSO *dso, const char *filename)
{
shl_t ptr;
char translated[DSO_MAX_TRANSLATED_SIZE];
int len;
/* The same comment as in dlfcn_load applies here. bleurgh. */
len = strlen(filename) + strlen(extension);
if((dso->flags & DSO_FLAG_NAME_TRANSLATION) &&
(len + 3 < DSO_MAX_TRANSLATED_SIZE) &&
(strstr(filename, "/") == NULL))
{
sprintf(translated, "lib%s%s", filename, extension);
ptr = shl_load(translated, BIND_IMMEDIATE, NULL);
}
else
ptr = shl_load(filename, BIND_IMMEDIATE, NULL);
if(ptr == NULL)
{
DSOerr(DSO_F_DL_LOAD,DSO_R_LOAD_FAILED);
return(0);
}
if(!sk_push(dso->meth_data, (char *)ptr))
{
DSOerr(DSO_F_DL_LOAD,DSO_R_STACK_ERROR);
shl_unload(ptr);
return(0);
}
return(1);
}
开发者ID:aosm,项目名称:OpenSSL096,代码行数:30,代码来源:dso_dl.c
示例5: shl_load
void *dlopen(const char *fname, int mode)
{
shl_t handle;
LibEntry entry = NULL;
dlerrno = 0;
if (fname == NULL)
handle = PROG_HANDLE;
else {
handle = shl_load(fname, mode | BIND_VERBOSE, 0L);
if (handle != NULL) {
if ((entry = find_lib_entry(handle)) == NULL) {
if ((entry = new_lib_entry(handle)) == NULL) {
shl_unload(handle);
handle = NULL;
}
}
else
increment_lib_entry_count(entry);
}
if (handle == NULL) {
dlerrno = 1;
sprintf(errbuf, "can't open %s", fname);
}
}
#ifdef DEBUG
printf("opening library %s, handle = %x, count = %d\n",
fname, handle, entry ? lib_entry_count(entry) : -1);
if (dlerrno) printf("%s\n", dlerror());
#endif
return (void *) handle;
}
开发者ID:csilles,项目名称:cxxr,代码行数:32,代码来源:hpdlfcn.c
示例6: dlclose
int dlclose(void *handle)
{
LibEntry entry;
#ifdef DEBUG
entry = find_lib_entry(handle);
printf("closing library handle = %x, count = %d\n",
handle, entry ? lib_entry_count(entry) : -1);
#endif
dlerrno = 0;
if ((shl_t) handle == PROG_HANDLE)
return 0; /* ignore attempts to close main program */
else {
if ((entry = find_lib_entry((shl_t) handle)) != NULL) {
decrement_lib_entry_count(entry);
if (lib_entry_count(entry) > 0)
return 0;
else {
/* unload once reference count reaches zero */
free_lib_entry(entry);
if (shl_unload((shl_t) handle) == 0)
return 0;
}
}
/* if you get to here, an error has occurred */
dlerrno = 1;
sprintf(errbuf, "attempt to close library failed");
#ifdef DEBUG
printf("%s\n", dlerror());
#endif
return -1;
}
}
开发者ID:csilles,项目名称:cxxr,代码行数:34,代码来源:hpdlfcn.c
示例7: unload_sys
bool QLibraryPrivate::unload_sys()
{
if (shl_unload((shl_t)pHnd)) {
qWarning("QLibrary: Cannot unload %s", QFile::encodeName(fileName).constData());
return false;
}
return true;
}
开发者ID:psi-im,项目名称:neatstuff,代码行数:8,代码来源:qlibrary_unix.cpp
示例8: unloadSharedObject
void
unloadSharedObject (void *object) {
#ifdef HAVE_SHL_LOAD
if (shl_unload(object) == -1)
logMessage(LOG_ERR, "Shared library unload error: %s",
strerror(errno));
#endif /* HAVE_SHL_LOAD */
}
开发者ID:plundblad,项目名称:brltty,代码行数:8,代码来源:dynld_shl.c
示例9: dClose
static void dClose(void * handle)
{
#ifdef __hpux
shl_unload(handle);
#else
dlclose(handle);
#endif
}
开发者ID:innisfree,项目名称:superpy,代码行数:8,代码来源:dynamic_cs.c
示例10: sane_exit
void
sane_exit (void)
{
struct backend *be, *next;
struct alias *alias;
DBG(2, "sane_exit: exiting\n");
for (be = first_backend; be; be = next)
{
next = be->next;
if (be->loaded)
{
DBG(3, "sane_exit: calling backend `%s's exit function\n", be->name);
(*be->op[OP_EXIT]) ();
#ifdef HAVE_DLL
#ifdef HAVE_DLOPEN
if (be->handle)
dlclose (be->handle);
#elif defined(HAVE_SHL_LOAD)
if (be->handle)
shl_unload(be->handle);
#else
# error "Tried to compile unsupported DLL."
#endif /* HAVE_DLOPEN */
#endif /* HAVE_DLL */
}
if (!be->permanent)
{
if (be->name)
free ((void *) be->name);
free (be);
}
}
first_backend = 0;
while( (alias = first_alias) != NULL )
{
first_alias = first_alias->next;
free(alias->oldname);
free(alias);
}
if (NULL != devlist)
{ /* Release memory allocated by sane_get_devices(). */
int i = 0;
while (devlist[i])
free(devlist[i++]);
free(devlist);
devlist = NULL;
devlist_size = 0;
devlist_len = 0;
}
DBG(3, "sane_exit: finished\n");
}
开发者ID:StKob,项目名称:debian_copyist_brother,代码行数:58,代码来源:dll.c
示例11: ap_os_dso_unload
void ap_os_dso_unload(void *handle)
{
#if defined(HPUX) || defined(HPUX10)
shl_unload((shl_t)handle);
#else
dlclose(handle);
#endif
return;
}
开发者ID:paulur,项目名称:vul-apache,代码行数:9,代码来源:os.c
示例12: defined
bool QLibraryPrivate::unload_sys()
{
#if !defined(QT_NO_DYNAMIC_LIBRARY)
# if defined(QT_HPUX_LD)
if (shl_unload((shl_t)pHnd)) {
# else
if (dlclose(pHnd)) {
# endif
errorString = QLibrary::tr("Cannot unload library %1: %2").arg(fileName).arg(qdlerror());
return false;
}
#endif
errorString.clear();
return true;
}
#ifdef Q_OS_LINUX
Q_CORE_EXPORT QFunctionPointer qt_linux_find_symbol_sys(const char *symbol)
{
return QFunctionPointer(dlsym(RTLD_DEFAULT, symbol));
}
#endif
#ifdef Q_OS_MAC
Q_CORE_EXPORT QFunctionPointer qt_mac_resolve_sys(void *handle, const char *symbol)
{
return QFunctionPointer(dlsym(handle, symbol));
}
#endif
QFunctionPointer QLibraryPrivate::resolve_sys(const char* symbol)
{
#if defined(QT_AOUT_UNDERSCORE)
// older a.out systems add an underscore in front of symbols
char* undrscr_symbol = new char[strlen(symbol)+2];
undrscr_symbol[0] = '_';
strcpy(undrscr_symbol+1, symbol);
QFunctionPointer address = QFunctionPointer(dlsym(pHnd, undrscr_symbol));
delete [] undrscr_symbol;
#elif defined(QT_HPUX_LD)
QFunctionPointer address = 0;
if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0)
address = 0;
#elif defined (QT_NO_DYNAMIC_LIBRARY)
QFunctionPointer address = 0;
#else
QFunctionPointer address = QFunctionPointer(dlsym(pHnd, symbol));
#endif
if (!address) {
errorString = QLibrary::tr("Cannot resolve symbol \"%1\" in %2: %3").arg(
QString::fromLatin1(symbol)).arg(fileName).arg(qdlerror());
} else {
errorString.clear();
}
return address;
}
开发者ID:KDE,项目名称:android-qt5-qtbase,代码行数:56,代码来源:qlibrary_unix.cpp
示例13: _g_module_close
static void
_g_module_close (gpointer handle,
gboolean is_unref)
{
if (!is_unref)
{
if (shl_unload ((shl_t) handle) != 0)
g_module_set_error (g_strerror (errno));
}
}
开发者ID:01org,项目名称:android-bluez-glib,代码行数:10,代码来源:gmodule-dld.c
示例14: myFreeLibrary
/******************************************************************
*
* Porting Free library function to different platforms
*
*******************************************************************/
void myFreeLibrary(HINSTANCE hKVFILTER)
{
#if defined(_WINDOWS)
FreeLibrary( hKVFILTER );
#elif defined(_HPUX11)
shl_unload((shl_t)hKVFILTER);
#else
dlclose(hKVFILTER);
#endif
}
开发者ID:firememory,项目名称:dfwbi,代码行数:15,代码来源:dllapi.cpp
示例15: TclpUnloadFile
void
TclpUnloadFile(
Tcl_LoadHandle loadHandle) /* loadHandle returned by a previous call to
* TclpDlopen(). The loadHandle is a token
* that represents the loaded file. */
{
shl_t handle;
handle = (shl_t) loadHandle;
shl_unload(handle);
}
开发者ID:AbaqusPowerUsers,项目名称:AbaqusPythonScripts,代码行数:11,代码来源:tclLoadShl.c
示例16: unload_library
void unload_library() {
#if defined(LINUX) || defined(SUN) || defined(AIX) || defined(CYGWIN)
dlclose(handle_);
#elif defined(HP)
shl_unload(handle_);
#else
/* This type of UNIX has no DLL support yet */
throw dll_exception("Unsupported Unix flavour (please report this): " + module_.string());
#endif
}
开发者ID:Vilse1202,项目名称:nscp,代码行数:11,代码来源:impl_unix.hpp
示例17: lock
void SharedLibraryImpl::unloadImpl()
{
FastMutex::ScopedLock lock(_mutex);
if (_handle)
{
shl_unload(_handle);
_handle = 0;
_path.clear();
}
}
开发者ID:BrianHoldsworth,项目名称:Poco,代码行数:11,代码来源:SharedLibrary_HPUX.cpp
示例18: vm_close
/* A function called through the vtable when a particular module
should be unloaded. */
static int
vm_close (lt_user_data LT__UNUSED loader_data, lt_module module)
{
int errors = 0;
if (module && (shl_unload ((shl_t) (module)) != 0))
{
LT__SETERROR (CANNOT_CLOSE);
++errors;
}
return errors;
}
开发者ID:ILUZIO,项目名称:libtool,代码行数:15,代码来源:shl_load.c
示例19: fxdllClose
// Close DLL of given dllhandle
void fxdllClose(void* dllhandle){
if(dllhandle){
#ifndef WIN32
#ifdef HAVE_SHL_LOAD // HP-UX
shl_unload((shl_t)dllhandle);
#else // POSIX
dlclose(dllhandle);
#endif
#else // WIN32
FreeLibrary((HMODULE)dllhandle);
#endif
}
}
开发者ID:gfphoenix,项目名称:tsiu,代码行数:14,代码来源:FXDLL.cpp
示例20: close_object
static void
close_object(XI18NObjectsList object)
{
object->refcount--;
if (object->refcount == 0)
{
#if defined(hpux)
shl_unload(object->dl_module);
#else
dlclose(object->dl_module);
#endif
object->dl_module = NULL;
}
}
开发者ID:iquiw,项目名称:xsrc,代码行数:14,代码来源:XlcDL.c
注:本文中的shl_unload函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论