本文整理汇总了C++中QLibrary::unload方法的典型用法代码示例。如果您正苦于以下问题:C++ QLibrary::unload方法的具体用法?C++ QLibrary::unload怎么用?C++ QLibrary::unload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLibrary
的用法示例。
在下文中一共展示了QLibrary::unload方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReleaseLibraries
void ReleaseLibraries(void)
{
if(eCompass.isLoaded())
{
eCompass.unload();
}
if(Altimeter.isLoaded())
{
Altimeter.unload();
}
if(Nordic.isLoaded())
{
Nordic.unload();
}
if(GPS.isLoaded())
{
GPS.unload();
}
}
示例2: c
QHSWidgetImpl::~QHSWidgetImpl()
{
delete iHsWidgetPublisher;
const QObjectList& c(children());
foreach (QObject* child, c)
{
QLibrary* lib = qobject_cast<QLibrary*> (child);
if (lib) lib->unload();
}
示例3: errorString
void tst_QLibrary::errorString()
{
QFETCH(int, operation);
QFETCH(QString, fileName);
QFETCH(bool, success);
QFETCH(QString, errorString);
QLibrary lib;
if (!(operation & DontSetFileName)) {
lib.setFileName(fileName);
}
bool ok = false;
switch (operation & OperationMask) {
case Load:
ok = lib.load();
break;
case Unload:
ok = lib.load(); //###
ok = lib.unload();
break;
case Resolve: {
ok = lib.load();
QCOMPARE(ok, true);
if (success) {
ok = lib.resolve("mylibversion");
} else {
ok = lib.resolve("nosuchsymbol");
}
break;}
default:
QFAIL(qPrintable(QString("Unknown operation: %1").arg(operation)));
break;
}
QRegExp re(errorString);
QString libErrorString = lib.errorString();
QVERIFY(!lib.isLoaded() || lib.unload());
QVERIFY2(re.exactMatch(libErrorString), qPrintable(libErrorString));
QCOMPARE(ok, success);
}
示例4: unload
bool unload(const char* dllname)
{
QLibrary *dll = library(dllname);
if (!dll) {
DBG("'%s' is not loaded\n", dllname);
return true;
}
if (!dll->unload()) {
DBG("%s", dll->errorString().toUtf8().constData());
return false;
}
sDllMap.erase(std::find_if(sDllMap.begin(), sDllMap.end(), std::bind2nd(map_value_equal<dllmap_t>(), dll))->first);
delete dll;
return true;
}
示例5: closePlug
void closePlug(bool b)
{
if ( isOpen )
{
qmplay_pa_simple_free( pulse );
if ( REC )
qmplay_pa_simple_free( pulseREC );
pa_lib.unload();
isOpen = false;
mustReset = false;
}
REC = false;
if ( !b )
{
fs.setParent( NULL );
fs.close();
}
}
示例6: loadHints
void tst_QLibrary::loadHints()
{
QFETCH( QString, lib );
QFETCH( int, loadHints);
QFETCH( bool, result );
//QLibrary library( lib );
QLibrary library;
QLibrary::LoadHints lh(loadHints);
if (int(loadHints) != 0) {
lh |= library.loadHints();
library.setLoadHints(lh);
}
library.setFileName(lib);
QCOMPARE(library.loadHints(), lh);
bool ok = library.load();
if ( result ) {
QVERIFY( ok );
QVERIFY(library.unload());
} else {
QVERIFY( !ok );
}
}
示例7:
virtual ~DynamicLibraryImpl() {
if (lib)
lib->unload();
lib = 0;
}
示例8: dir
PluginInfoList& PluginFactory::rescan()
{
//remove plugins that are not loaded
PluginInfoList::Iterator it = infoList.begin();
while( it != infoList.end() ) {
PluginInfo *info = (*it).first;
if( !info ) continue;
//plugin is not loaded
if( !info->get() ) {
QLibrary *lib = (*it).second;
lib->unload();
delete lib;
it = infoList.remove(it);
continue;
}
++it;
}
//load all plugins (and avoid collisions)
QRegExp libRxp = QRegExp( "^lib.*\\.so[0-9.]*$" );
//QRegExp libRxp = QRegExp( "^lib.*" );
PluginInfoList pluginList;
QStringList libraryPaths = ancaConf->readListEntry( LIBRARY_PATHS, LIBRARY_PATHS_DEFAULT );
#ifdef PREL
libraryPaths.append( PREL "/share/anca/plugins");
#endif
libraryPaths.append(QDir::homeDirPath() + "/.anca/plugins");
//iterate all paths where plugins should be
for ( QStringList::iterator it = libraryPaths.begin(); it != libraryPaths.end(); ++it ) {
PTRACE( 3, "Searching directory " << ( *it ).latin1() << " for plugins" );
QDir dir( *it );
if ( !dir.exists() ) continue;
dir.setFilter( QDir::Files | QDir::NoSymLinks );
const QFileInfoList *fileList = dir.entryInfoList();
QFileInfo *file;
QLibrary *lib;
//iterate all files in the directory
for ( QFileInfoListIterator fit( *fileList ); ( file = *fit ); ++fit ) {
//is the file plugin?
if ( !file->fileName().contains( libRxp ) ) continue;
//open plugin
lib = new QLibrary( file->filePath().latin1() );
if( !lib->load() ) {
PTRACE( 3, "Library " << file->fileName().latin1() << " could not be loaded" );
continue;
}
//resolve symbol 'getPluginInfo'
if ( GetPluginInfo * getPluginInfo = ( GetPluginInfo* ) lib->resolve( "getPluginInfo" ) ) {
PluginInfo * pluginInfo = getPluginInfo();
pluginList.append( PluginInfoPair(pluginInfo, lib) );
} else {
PTRACE( 3, "Symbol \"getPluginInfo\" not found in library " << file->fileName().latin1() );
delete lib;
}
}
}
//insert that pluginInfo to class infoList that in not already there
for( PluginInfoList::iterator it = pluginList.begin(); it != pluginList.end(); ++it ) {
QLibrary *lib = (*it).second;
if( !lib ) continue;
if( !infoList.contains( *it ) )
infoList.append( *it );
else {
lib->unload();
delete lib;
}
}
// sort plugins according to type
qHeapSort(infoList);
return infoList;
}
示例9: Init
void Init( bool b, int rate2, int bits2, int chn2, int /*buff*/ )
{
mustReset = false;
if ( !b )
{
Save.odczytajopcje();
fs.Init();
fs.ApplyB();
}
PlErr = false;
if ( b )
{
if ( !isOpen )
{
if ( !pa_lib.isLoaded() )
{
QString libName = "libpulse-simple" + libExt;
#ifdef Q_WS_X11
libName += ".0";
#endif
pa_lib.setFileName( libName );
if ( !pa_lib.load() )
{
errStr = pa_lib.errorString();
PlErr = true;
return;
}
qmplay_pa_simple_new = ( _qmplay_pa_simple_new )pa_lib.resolve( "pa_simple_new" );
qmplay_pa_simple_free = ( _qmplay_pa_simple_free )pa_lib.resolve( "pa_simple_free" );
qmplay_pa_simple_write = ( _qmplay_pa_simple_write )pa_lib.resolve( "pa_simple_write" );
qmplay_pa_simple_read = ( _qmplay_pa_simple_read )pa_lib.resolve( "pa_simple_read" );
qmplay_pa_simple_flush = ( _qmplay_pa_simple_flush )pa_lib.resolve( "pa_simple_flush" );
if ( !qmplay_pa_simple_new || !qmplay_pa_simple_free || !qmplay_pa_simple_write || !qmplay_pa_simple_read || !qmplay_pa_simple_flush )
{
pa_lib.unload();
errStr = "błąd podczas pobierania funkcji z biblioteki: " + libName;
PlErr = true;
return;
}
}
switch ( bits2 )
{
case 8:
ss.format = PA_SAMPLE_U8;
break;
case 16:
ss.format = PA_SAMPLE_S16NE;
break;
case 24:
ss.format = PA_SAMPLE_S24NE;
break;
case 32:
ss.format = PA_SAMPLE_S32NE;
break;
}
ss.channels = chn2;
ss.rate = rate2;
attr.maxlength = ( uint32_t ) -1;
attr.tlength = delay * ( rate2 * ( bits2/8 ) * chn2 );
attr.prebuf = ( uint32_t ) -1;
attr.minreq = ( uint32_t ) -1;
attr.fragsize = attr.tlength;
pa_channel_map *chn_map = NULL;
if ( chn2 > 2 && chn2 <= 8 )
{
chn_map = new pa_channel_map;
chn_map->channels = chn2;
chn_map->map[ 0 ] = PA_CHANNEL_POSITION_FRONT_LEFT;
chn_map->map[ 1 ] = PA_CHANNEL_POSITION_FRONT_RIGHT;
chn_map->map[ 2 ] = PA_CHANNEL_POSITION_FRONT_CENTER;
chn_map->map[ 3 ] = PA_CHANNEL_POSITION_LFE;
chn_map->map[ 4 ] = PA_CHANNEL_POSITION_REAR_LEFT;
chn_map->map[ 5 ] = PA_CHANNEL_POSITION_REAR_RIGHT;
chn_map->map[ 6 ] = PA_CHANNEL_POSITION_SIDE_LEFT;
chn_map->map[ 7 ] = PA_CHANNEL_POSITION_SIDE_RIGHT;
}
pulse = qmplay_pa_simple_new( NULL, "QMPlay", PA_STREAM_PLAYBACK, NULL, "Output", &ss, chn_map, &attr, NULL );
delete chn_map;
if ( !pulse )
{
pa_lib.unload();
errStr = "błąd podczas otwierania wyjścia PulseAudio";
PlErr = true;
return;
}
if ( REC )
{
pulseREC = qmplay_pa_simple_new( NULL, "QMPlay", PA_STREAM_RECORD, NULL, "Input", &ss, chn_map, &attr, NULL );
if ( !pulseREC )
{
qmplay_pa_simple_free( pulse );
pa_lib.unload();
errStr = "błąd podczas otwierania wejścia PulseAudio";
PlErr = true;
return;
//.........这里部分代码省略.........
示例10: loadModule
bool KviModuleManager::loadModule(const QString &modName)
{
if(findModule(modName))
{
//qDebug("MODULE %s ALREADY IN CORE MEMORY",modName);
return true;
}
QString tmp;
QString szName;
#if defined(COMPILE_ON_WINDOWS)
KviQString::appendFormatted(szName,"kvi%Q.dll",&modName);
#elif defined(COMPILE_ON_MINGW)
KviQString::appendFormatted(szName,"libkvi%Q.dll",&modName);
#else
KviQString::appendFormatted(szName,"libkvi%Q.so",&modName);
#endif
szName=szName.toLower();
g_pApp->getLocalKvircDirectory(tmp,KviApplication::Modules,szName);
if(!KviFileUtils::fileExists(tmp))
{
g_pApp->getGlobalKvircDirectory(tmp,KviApplication::Modules,szName);
}
QLibrary* pLibrary = new QLibrary(tmp);
pLibrary->setLoadHints(QLibrary::ExportExternalSymbolsHint);
if(!pLibrary->load())
{
m_szLastError = pLibrary->errorString();
delete pLibrary;
return false;
}
KviModuleInfo * info = (KviModuleInfo *)pLibrary->resolve(KVIRC_MODULE_STRUCTURE_SYMBOL);
if(!info)
{
m_szLastError = __tr2qs("No " KVIRC_MODULE_STRUCTURE_SYMBOL " symbol exported: not a kvirc module ?");
pLibrary->unload();
delete pLibrary;
return false;
}
if(!info->szKVIrcVersion)
{
m_szLastError = __tr2qs("This module has no version information: refusing to load it");
pLibrary->unload();
delete pLibrary;
return false;
}
if(!KVI_OPTION_BOOL(KviOption_boolIgnoreModuleVersions))
{
if(!kvi_strEqualCS(info->szKVIrcVersion,KVI_VERSION))
{
m_szLastError = __tr2qs("This module was compiled for a different KVIrc version and can't be loaded");
m_szLastError += " (";
m_szLastError += info->szKVIrcVersion;
m_szLastError += ")";
pLibrary->unload();
delete pLibrary;
return false;
}
}
KviModule * module = new KviModule(pLibrary,info,modName,szName.toUtf8().data());
// the module is probably up.. the only thing can fail is the init_routine now
// load the message catalogue if any
if(info->szModuleContext)
{
QString szDir;
// it's more probable to have the translations in the global directory
// try it as first... (yes, catalogue overriding is impossible this way.. but, anybody cares ?)
g_pApp->getGlobalKvircDirectory(szDir,KviApplication::Locale);
if(!KviLocale::instance()->loadCatalogue(info->szModuleContext,szDir))
{
// try the local directory then
g_pApp->getLocalKvircDirectory(szDir,KviApplication::Locale);
KviLocale::instance()->loadCatalogue(info->szModuleContext,szDir);
}
}
if(info->init_routine)
{
if(!((info->init_routine)(module)))
{
m_szLastError = __tr2qs("Failed to execute the init routine");
//qDebug("ERROR IN LOADING MODULE %s (%s): failed to execute the init routine",modName,szName.ptr());
delete module;
// kill the message catalogue too then
KviLocale::instance()->unloadCatalogue(modName);
return false;
}
}
m_pModuleDict->insert(modName,module);
/*
registerDefaultCommands(module);
*/
module->registerDefaultCommands();
//.........这里部分代码省略.........
示例11:
virtual ~SnoopWinDivertLib()
{
lib->unload();
SAFE_DELETE(lib);
}