summaryrefslogtreecommitdiff
path: root/library/qlibrary_unix.cpp
Unidiff
Diffstat (limited to 'library/qlibrary_unix.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qlibrary_unix.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp
index 50a5478..7740321 100644
--- a/library/qlibrary_unix.cpp
+++ b/library/qlibrary_unix.cpp
@@ -1,100 +1,100 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "qlibrary_p.h" 21#include "qlibrary_p.h"
22 22
23#ifndef QT_NO_COMPONENT 23#ifndef QT_NO_COMPONENT
24 24
25/* 25/*
26 The platform dependent implementations of 26 The platform dependent implementations of
27 - loadLibrary 27 - loadLibrary
28 - freeLibrary 28 - freeLibrary
29 - resolveSymbol 29 - resolveSymbol
30 30
31 It's not too hard to guess what the functions do. 31 It's not too hard to guess what the functions do.
32*/ 32*/
33#if defined(Q_OS_HPUX) 33#if defined(Q_OS_HPUX)
34// for HP-UX < 11.x and 32 bit 34// for HP-UX < 11.x and 32 bit
35#include <dl.h> 35#include <dl.h>
36 36
37bool QLibraryPrivate::loadLibrary() 37bool QLibraryPrivate::loadLibrary()
38{ 38{
39 if ( pHnd ) 39 if ( pHnd )
40 return TRUE; 40 return TRUE;
41 41
42 QString filename = library->library(); 42 QString filename = library->library();
43 43
44 pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 ); 44 pHnd = (void*)shl_load( filename.latin1(), BIND_DEFERRED | BIND_NONFATAL | DYNAMIC_PATH, 0 );
45#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 45#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
46 if ( !pHnd ) 46 if ( !pHnd )
47 qDebug( "Failed to load library %s!", filename.latin1() ); 47 qDebug( "Failed to load library %s!", filename.latin1() );
48#endif 48#endif
49 return pHnd != 0; 49 return pHnd != 0;
50} 50}
51 51
52bool QLibraryPrivate::freeLibrary() 52bool QLibraryPrivate::freeLibrary()
53{ 53{
54 if ( !pHnd ) 54 if ( !pHnd )
55 return TRUE; 55 return TRUE;
56 56
57 if ( !shl_unload( (shl_t)pHnd ) ) { 57 if ( !shl_unload( (shl_t)pHnd ) ) {
58 pHnd = 0; 58 pHnd = 0;
59 return TRUE; 59 return TRUE;
60 } 60 }
61 return FALSE; 61 return FALSE;
62} 62}
63 63
64void* QLibraryPrivate::resolveSymbol( const char* symbol ) 64void* QLibraryPrivate::resolveSymbol( const char* symbol )
65{ 65{
66 if ( !pHnd ) 66 if ( !pHnd )
67 return 0; 67 return 0;
68 68
69 void* address = 0; 69 void* address = 0;
70 if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) { 70 if ( shl_findsym( (shl_t*)&pHnd, symbol, TYPE_UNDEFINED, address ) < 0 ) {
71#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 71#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
72 qDebug( "Couldn't resolve symbol \"%s\"", symbol ); 72 qDebug( "Couldn't resolve symbol \"%s\"", symbol );
73#endif 73#endif
74 return 0; 74 return 0;
75 } 75 }
76 return address; 76 return address;
77} 77}
78 78
79#else // Q_OS_HPUX 79#else // Q_OS_HPUX
80// Something else, assuming POSIX 80// Something else, assuming POSIX
81#include <dlfcn.h> 81#include <dlfcn.h>
82 82
83bool QLibraryPrivate::loadLibrary() 83bool QLibraryPrivate::loadLibrary()
84{ 84{
85 if ( pHnd ) 85 if ( pHnd )
86 return TRUE; 86 return TRUE;
87 87
88 QString filename = library->library(); 88 QString filename = library->library();
89 89
90 pHnd = dlopen( filename.latin1() , RTLD_LAZY ); 90 pHnd = dlopen( filename.latin1() , RTLD_LAZY );
91#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) 91#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT)
92 if ( !pHnd ) 92 if ( !pHnd )
93 qWarning( "%s", dlerror() ); 93 qWarning( "%s", dlerror() );
94#endif 94#endif
95 return pHnd != 0; 95 return pHnd != 0;
96} 96}
97 97
98bool QLibraryPrivate::freeLibrary() 98bool QLibraryPrivate::freeLibrary()
99{ 99{
100 if ( !pHnd ) 100 if ( !pHnd )