Diffstat (limited to 'qmake/tools/qlibrary_unix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | qmake/tools/qlibrary_unix.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/qmake/tools/qlibrary_unix.cpp b/qmake/tools/qlibrary_unix.cpp index f0fbdf6..12b9310 100644 --- a/qmake/tools/qlibrary_unix.cpp +++ b/qmake/tools/qlibrary_unix.cpp | |||
@@ -1,104 +1,121 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Implementation of QLibraryPrivate class | 4 | ** Implementation of QLibraryPrivate class |
5 | ** | 5 | ** |
6 | ** Created : 2000-01-01 | 6 | ** Created : 000101 |
7 | ** | 7 | ** |
8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
9 | ** | 9 | ** |
10 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
11 | ** | 11 | ** |
12 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
13 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
14 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
15 | ** | 15 | ** |
16 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
17 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
18 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
19 | ** packaging of this file. | 19 | ** packaging of this file. |
20 | ** | 20 | ** |
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition | 21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition |
22 | ** licenses may use this file in accordance with the Qt Commercial License | 22 | ** licenses may use this file in accordance with the Qt Commercial License |
23 | ** Agreement provided with the Software. | 23 | ** Agreement provided with the Software. |
24 | ** | 24 | ** |
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
27 | ** | 27 | ** |
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for | 28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for |
29 | ** information about Qt Commercial License Agreements. | 29 | ** information about Qt Commercial License Agreements. |
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. | 30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information. |
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
32 | ** | 32 | ** |
33 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
34 | ** not clear to you. | 34 | ** not clear to you. |
35 | ** | 35 | ** |
36 | **********************************************************************/ | 36 | **********************************************************************/ |
37 | 37 | ||
38 | #include "qplatformdefs.h" | 38 | #include "qplatformdefs.h" |
39 | #include "private/qlibrary_p.h" | 39 | #include "private/qlibrary_p.h" |
40 | 40 | ||
41 | #ifndef QT_NO_LIBRARY | 41 | #ifndef QT_NO_LIBRARY |
42 | 42 | ||
43 | #if defined(QT_AOUT_UNDERSCORE) | 43 | #if defined(QT_AOUT_UNDERSCORE) |
44 | #include <string.h> | 44 | #include <string.h> |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | /* | 47 | /* |
48 | The platform dependent implementations of | 48 | The platform dependent implementations of |
49 | - loadLibrary | 49 | - loadLibrary |
50 | - freeLibrary | 50 | - freeLibrary |
51 | - resolveSymbol | 51 | - resolveSymbol |
52 | 52 | ||
53 | It's not too hard to guess what the functions do. | 53 | It's not too hard to guess what the functions do. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #if defined(QT_HPUX_LD) // for HP-UX < 11.x and 32 bit | 56 | #if defined(Q_OS_MAC) |
57 | |||
58 | bool QLibraryPrivate::loadLibrary() | ||
59 | { | ||
60 | return FALSE; | ||
61 | } | ||
62 | |||
63 | bool QLibraryPrivate::freeLibrary() | ||
64 | { | ||
65 | return FALSE; | ||
66 | } | ||
67 | |||
68 | void* QLibraryPrivate::resolveSymbol( const char* ) | ||
69 | { | ||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | #elif defined(QT_HPUX_LD) // for HP-UX < 11.x and 32 bit | ||
57 | 74 | ||
58 | bool QLibraryPrivate::loadLibrary() | 75 | bool QLibraryPrivate::loadLibrary() |
59 | { | 76 | { |
60 | if ( pHnd ) | 77 | if ( pHnd ) |
61 | return TRUE; | 78 | return TRUE; |
62 | 79 | ||
63 | QString filename = library->library(); | 80 | QString filename = library->library(); |
64 | 81 | ||
65 | pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 ); | 82 | pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 ); |
66 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 83 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
67 | if ( !pHnd ) | 84 | if ( !pHnd ) |
68 | qWarning( "%s: failed to load library!", filename.latin1() ); | 85 | qWarning( "%s: failed to load library!", filename.latin1() ); |
69 | #endif | 86 | #endif |
70 | return pHnd != 0; | 87 | return pHnd != 0; |
71 | } | 88 | } |
72 | 89 | ||
73 | bool QLibraryPrivate::freeLibrary() | 90 | bool QLibraryPrivate::freeLibrary() |
74 | { | 91 | { |
75 | if ( !pHnd ) | 92 | if ( !pHnd ) |
76 | return TRUE; | 93 | return TRUE; |
77 | 94 | ||
78 | if ( shl_unload( (shl_t)pHnd ) ) { | 95 | if ( shl_unload( (shl_t)pHnd ) ) { |
79 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) | 96 | #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) |
80 | QString filename = library->library(); | 97 | QString filename = library->library(); |
81 | qWarning( "%s: Failed to unload library!", filename.latin1() ); | 98 | qWarning( "%s: Failed to unload library!", filename.latin1() ); |
82 | #endif | 99 | #endif |
83 | return FALSE; | 100 | return FALSE; |
84 | } | 101 | } |
85 | pHnd = 0; | 102 | pHnd = 0; |
86 | return TRUE; | 103 | return TRUE; |
87 | } | 104 | } |
88 | 105 | ||
89 | void* QLibraryPrivate::resolveSymbol( const char* symbol ) | 106 | void* QLibraryPrivate::resolveSymbol( const char* symbol ) |
90 | { | 107 | { |
91 | if ( !pHnd ) | 108 | if ( !pHnd ) |
92 | return 0; | 109 | return 0; |
93 | 110 | ||
94 | void* address = 0; | 111 | void* address = 0; |
95 | if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address ) < 0 ) { | 112 | if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address ) < 0 ) { |
96 | #if defined(QT_DEBUG_COMPONENT) | 113 | #if defined(QT_DEBUG_COMPONENT) |
97 | QString filename = library->library(); | 114 | QString filename = library->library(); |
98 | qWarning( "%s: couldn't resolve symbol \"%s\"", filename.latin1(), symbol ); | 115 | qWarning( "%s: couldn't resolve symbol \"%s\"", filename.latin1(), symbol ); |
99 | #endif | 116 | #endif |
100 | } | 117 | } |
101 | return address; | 118 | return address; |
102 | } | 119 | } |
103 | 120 | ||
104 | #else // POSIX | 121 | #else // POSIX |