summaryrefslogtreecommitdiff
path: root/qmake/tools/qlibrary.cpp
Side-by-side diff
Diffstat (limited to 'qmake/tools/qlibrary.cpp') (more/less context) (show whitespace changes)
-rw-r--r--qmake/tools/qlibrary.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/qmake/tools/qlibrary.cpp b/qmake/tools/qlibrary.cpp
index 564db30..be1d54b 100644
--- a/qmake/tools/qlibrary.cpp
+++ b/qmake/tools/qlibrary.cpp
@@ -1,32 +1,32 @@
/****************************************************************************
** $Id$
**
** Implementation of QLibrary class
**
-** Created : 2000-01-01
+** Created : 000101
**
-** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
+** Copyright (C) 2000-2003 Trolltech AS. All rights reserved.
**
** This file is part of the tools module of the Qt GUI Toolkit.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
** licenses may use this file in accordance with the Qt Commercial License
** Agreement provided with the Software.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
@@ -50,49 +50,49 @@
# define QT_DEBUG_COMPONENT 1
# endif
#endif
#if defined(QT_DEBUG_COMPONENT)
#include <qfile.h>
#endif
#if defined(Q_WS_WIN) && !defined(QT_MAKEDLL)
#define QT_NO_LIBRARY_UNLOAD
#endif
QLibraryPrivate::QLibraryPrivate( QLibrary *lib )
: pHnd( 0 ), library( lib )
{
}
/*!
\class QLibrary qlibrary.h
\reentrant
\brief The QLibrary class provides a wrapper for handling shared libraries.
\mainclass
- \group plugins
+ \ingroup plugins
An instance of a QLibrary object can handle a single shared
library and provide access to the functionality in the library in
a platform independent way. If the library is a component server,
QLibrary provides access to the exported component and can
directly query this component for interfaces.
QLibrary ensures that the shared library is loaded and stays in
memory whilst it is in use. QLibrary can also unload the library
on destruction and release unused resources.
A typical use of QLibrary is to resolve an exported symbol in a
shared object, and to call the function that this symbol
represents. This is called "explicit linking" in contrast to
"implicit linking", which is done by the link step in the build
process when linking an executable against a library.
The following code snippet loads a library, resolves the symbol
"mysymbol", and calls the function if everything succeeded. If
something went wrong, e.g. the library file does not exist or the
symbol is not defined, the function pointer will be 0 and won't be
called. When the QLibrary object is destroyed the library will be
unloaded, making all references to memory allocated in the library
invalid.
@@ -305,39 +305,40 @@ void QLibrary::setAutoUnload( bool enabled )
Returns the filename of the shared library this QLibrary object
handles, including the platform specific file extension.
For example:
\code
QLibrary lib( "mylib" );
QString str = lib.library();
\endcode
will set \e str to "mylib.dll" on Windows, and "libmylib.so" on Linux.
*/
QString QLibrary::library() const
{
if ( libfile.isEmpty() )
return libfile;
QString filename = libfile;
#if defined(Q_WS_WIN)
if ( filename.findRev( '.' ) <= filename.findRev( '/' ) )
filename += ".dll";
#elif defined(Q_OS_MACX)
if ( filename.find( ".dylib" ) == -1 )
filename += ".dylib";
#else
- if ( filename.find( ".so" ) == -1 ) {
+ QString filter = ".so";
+ if ( filename.find(filter) == -1 ) {
const int x = filename.findRev( "/" );
if ( x != -1 ) {
QString path = filename.left( x + 1 );
QString file = filename.right( filename.length() - x - 1 );
- filename = QString( "%1lib%2.so" ).arg( path ).arg( file );
+ filename = QString( "%1lib%2.%3" ).arg( path ).arg( file ).arg( filter );
} else {
- filename = QString( "lib%1.so" ).arg( filename );
+ filename = QString( "lib%1.%2" ).arg( filename ).arg( filter );
}
}
#endif
return filename;
}
#endif //QT_NO_LIBRARY