summaryrefslogtreecommitdiff
authoreilers <eilers>2004-04-01 11:18:49 (UTC)
committer eilers <eilers>2004-04-01 11:18:49 (UTC)
commit833413cc389e7ddc929c081e29279a6556733407 (patch) (side-by-side diff)
tree1539009189e80de7ba6a825397742ead516f7164
parent4910b98d6fc0725337b494a03fa05e18209b99e3 (diff)
downloadopie-833413cc389e7ddc929c081e29279a6556733407.zip
opie-833413cc389e7ddc929c081e29279a6556733407.tar.gz
opie-833413cc389e7ddc929c081e29279a6556733407.tar.bz2
Fixed silly bug..
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/qlibrary_unix.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp
index 0229b7b..ff69286 100644
--- a/library/qlibrary_unix.cpp
+++ b/library/qlibrary_unix.cpp
@@ -68,176 +68,176 @@ void* QLibraryPrivate::resolveSymbol( const char* symbol )
void* address = 0;
if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) {
#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
qDebug( "Couldn't resolve symbol \"%s\"", symbol );
#endif
return 0;
}
return address;
}
#elif defined(_NULL_LIB_)
bool QLibraryPrivate::loadLibrary()
{
//qDebug("QLibraryPrivate::loadLibrary\n");
return FALSE;
}
bool QLibraryPrivate::freeLibrary()
{
//qDebug("QLibraryPrivate::freeLibrary\n");
return FALSE;
}
void* QLibraryPrivate::resolveSymbol( const char* symbol )
{
//qDebug("QLibraryPrivate::resolveSymbol\n");
return FALSE;
}
#elif defined(Q_OS_MACX)
#define ENUM_DYLD_BOOL
enum DYLD_BOOL {
DYLD_FALSE,
DYLD_TRUE
};
#include <mach-o/dyld.h>
typedef struct {
NSObjectFileImage img;
NSModule mod;
} DyldLibDesc;
bool QLibraryPrivate::loadLibrary()
{
// qDebug("QLibraryPrivate::loadLibrary\n");
// return FALSE;
if ( pHnd )
return TRUE;
QString filename = library->library();
NSObjectFileImage img = 0;
NSModule mod = 0;
NSObjectFileImageReturnCode ret = NSCreateObjectFileImageFromFile( filename.latin1() , &img );
if ( ret != NSObjectFileImageSuccess ) {
qWarning( "Error in NSCreateObjectFileImageFromFile(): %d; Filename: %s", ret, filename.latin1() );
if (ret == NSObjectFileImageAccess) {
qWarning ("(NSObjectFileImageAccess)" );
}
} else {
mod = NSLinkModule(img, filename.latin1(), NSLINKMODULE_OPTION_BINDNOW |
NSLINKMODULE_OPTION_PRIVATE |
NSLINKMODULE_OPTION_RETURN_ON_ERROR);
if (mod == 0) {
qWarning( "Error in NSLinkModule()" );
NSDestroyObjectFileImage(img);
}
}
DyldLibDesc* desc = 0;
if (img != 0 && mod != 0) {
desc = new DyldLibDesc;
desc->img = img;
desc->mod = mod;
}
pHnd = desc;
return pHnd != 0;
}
bool QLibraryPrivate::freeLibrary()
{
//qDebug("QLibraryPrivate::freeLibrary\n");
//return FALSE;
if ( !pHnd )
return TRUE;
DyldLibDesc* desc = (DyldLibDesc*) pHnd;
NSModule mod = desc->mod;
NSObjectFileImage img = desc->img;
DYLD_BOOL success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE);
if ( success ) {
NSDestroyObjectFileImage(img);
delete desc;
pHnd = 0;
}
#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
else {
- qWarning( "Error in NSUnLinkModule(): %d", ret );
+ qWarning( "Error in NSUnLinkModule()" );
}
#endif
return pHnd == 0;
}
void* QLibraryPrivate::resolveSymbol( const char* symbol )
{
//qDebug("QLibraryPrivate::resolveSymbol\n");
//return FALSE;
if ( !pHnd )
return 0;
DyldLibDesc* desc = (DyldLibDesc*) pHnd;
NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol);
void* address = 0;
if (sym != 0) {
address = NSAddressOfSymbol(sym);
}
#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
if ( address == 0 )
qWarning( "Cannot find symbol: %s", symbol );
#endif
return address;
}
#else
// Something else, assuming POSIX
#include <dlfcn.h>
bool QLibraryPrivate::loadLibrary()
{
if ( pHnd )
return TRUE;
QString filename = library->library();
pHnd = dlopen( filename.latin1() , RTLD_LAZY );
#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
if ( !pHnd )
qWarning( "%s", dlerror() );
#endif
return pHnd != 0;
}
bool QLibraryPrivate::freeLibrary()
{
if ( !pHnd )
return TRUE;
int ec = dlclose( pHnd );
if ( !ec )
pHnd = 0;
#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
else {
const char* error = dlerror();
if ( error )
qWarning( "%s", error );
}
#endif
return pHnd == 0;
}
void* QLibraryPrivate::resolveSymbol( const char* f )
{
if ( !pHnd )
return 0;
void* address = dlsym( pHnd, f );
#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
const char* error = dlerror();
if ( error )
qWarning( "%s", error );
#endif
return address;
}
#endif // POSIX
#endif // QT_NO_COMPONENT