#include <OSGSharedLibrary.h>
Public Types | |
Type | |
| enum | SharedLibraryType { Invalid = 0x0000, Application = 0x0001, SharedLib = 0x0002 } |
Public Member Functions | |
Constructors | |
| * | SharedLibrary (void) |
| SharedLibrary (const Char8 *szName) | |
Destructor | |
| *virtual | ~SharedLibrary (void) |
Class Specific | |
| *bool | open (const Char8 *szName) |
| bool | close (void) |
| AnonSymbolHandle | getSymbol (const Char8 *szSymbolName) |
| bool | isOpen (void) |
| const Char8 * | getName (void) |
Protected Member Functions | |
Helper | |
| *bool | open (void) |
Protected Attributes | |
| Char8 * | _szName |
| SharedHandle | _pHandle |
| SharedLibraryType | _type |
Static Protected Attributes | |
| static Char8 | _szApplicationName [] = "Application" |
Private Member Functions | |
| SharedLibrary (const SharedLibrary &source) | |
| prohibit default function (move to 'public' if needed) | |
| void | operator= (const SharedLibrary &source) |
| prohibit default function (move to 'public' if needed) | |
Definition at line 69 of file OSGSharedLibrary.h.
|
|
Definition at line 77 of file OSGSharedLibrary.h. 00078 { 00079 Invalid = 0x0000, 00080 Application = 0x0001, 00081 SharedLib = 0x0002 00082 };
|
|
|
Definition at line 63 of file OSGSharedLibrary.cpp.
|
|
|
Definition at line 70 of file OSGSharedLibrary.cpp. References _szApplicationName, _szName, _type, Application, open(), SharedLib, and osg::stringDup(). 00070 : 00071 _szName (NULL ), 00072 _pHandle(NULL ), 00073 _type (Invalid) 00074 { 00075 if(szName == NULL) 00076 { 00077 stringDup(_szApplicationName, _szName); 00078 00079 _type = Application; 00080 } 00081 else 00082 { 00083 stringDup(szName, _szName); 00084 00085 _type = SharedLib; 00086 } 00087 00088 this->open(); 00089 }
|
|
|
Definition at line 93 of file OSGSharedLibrary.cpp. References close(). 00094 { 00095 close(); 00096 }
|
|
|
|
|
|
Definition at line 100 of file OSGSharedLibrary.cpp. References _szApplicationName, _szName, _type, Application, close(), isOpen(), open(), SharedLib, and osg::stringDup(). 00101 { 00102 if(isOpen() == true) 00103 { 00104 close(); 00105 } 00106 00107 if(szName == NULL) 00108 { 00109 stringDup(_szApplicationName, _szName); 00110 00111 _type = Application; 00112 } 00113 else 00114 { 00115 stringDup(szName, _szName); 00116 00117 _type = SharedLib; 00118 } 00119 00120 return this->open(); 00121 }
|
|
|
Definition at line 123 of file OSGSharedLibrary.cpp. References _pHandle. Referenced by open(), and ~SharedLibrary(). 00124 { 00125 bool returnValue = false; 00126 00127 if(_pHandle != NULL) 00128 { 00129 #ifndef WIN32 00130 returnValue = (dlclose(_pHandle) == 0); 00131 #else 00132 returnValue = (FreeLibrary(_pHandle)) != FALSE; 00133 #endif 00134 _pHandle = NULL; 00135 } 00136 00137 return returnValue; 00138 }
|
|
|
Definition at line 140 of file OSGSharedLibrary.cpp. References _pHandle, isOpen(), and open(). 00141 { 00142 AnonSymbolHandle returnValue = NULL; 00143 00144 if(isOpen() == false) 00145 { 00146 if(open() == false) 00147 { 00148 return returnValue; 00149 } 00150 } 00151 00152 if(_pHandle != NULL && szSymbolName != NULL) 00153 { 00154 #ifndef WIN32 00155 returnValue = dlsym(_pHandle, szSymbolName); 00156 #else 00157 returnValue = (void*)GetProcAddress(_pHandle, szSymbolName); 00158 #endif 00159 } 00160 00161 #ifndef WIN32 00162 if(returnValue == NULL) 00163 fprintf(stderr, "%s\n", dlerror()); 00164 #else 00165 #endif 00166 00167 fprintf(stderr, "Got Symbol : %s %p %p\n", 00168 szSymbolName, 00169 _pHandle, 00170 returnValue); 00171 00172 return returnValue; 00173 }
|
|
|
Definition at line 175 of file OSGSharedLibrary.cpp. References _pHandle. Referenced by getSymbol(), and open(). 00176 { 00177 return _pHandle != NULL; 00178 }
|
|
|
Definition at line 180 of file OSGSharedLibrary.cpp. References _szName. 00181 { 00182 return _szName; 00183 }
|
|
|
Definition at line 187 of file OSGSharedLibrary.cpp. References _pHandle, _szName, _type, and SharedLib. Referenced by getSymbol(), open(), and SharedLibrary(). 00188 { 00189 Char8 *libName = NULL; 00190 00191 if(_pHandle != NULL) 00192 { 00193 return true; 00194 } 00195 00196 if(_type == SharedLib) 00197 { 00198 libName = _szName; 00199 } 00200 00201 #ifndef WIN32 00202 #ifdef OSG_DLOPEN_LAZY 00203 _pHandle = dlopen(libName, RTLD_LAZY | RTLD_GLOBAL); 00204 #else 00205 _pHandle = dlopen(libName, RTLD_NOW | RTLD_GLOBAL); 00206 #endif 00207 00208 if(_pHandle == NULL) 00209 { 00210 fprintf(stderr, "%s\n", dlerror()); 00211 } 00212 #else 00213 _pHandle = LoadLibrary(libName); 00214 #endif 00215 00216 return (_pHandle != NULL); 00217 }
|
|
|
|
|
|
Definition at line 58 of file OSGSharedLibrary.cpp. Referenced by open(), and SharedLibrary(). |
|
|
Definition at line 120 of file OSGSharedLibrary.h. Referenced by getName(), open(), and SharedLibrary(). |
|
|
Definition at line 121 of file OSGSharedLibrary.h. Referenced by close(), getSymbol(), isOpen(), and open(). |
|
|
Definition at line 123 of file OSGSharedLibrary.h. Referenced by open(), and SharedLibrary(). |
1.4.3