|
|||
|
|||
|
#include <dynamic.h>
Inheritance diagram for DLLManager:


Public Member Functions | |
| DLLManager (InspIRCd *ServerInstance, const char *fname) | |
| This constructor loads the module using dlopen(). | |
| virtual | ~DLLManager () |
| bool | GetSymbol (void **v, const char *sym_name) |
| Get a symbol using dynamic linking. | |
| char * | LastError () |
| Get the last error from dlopen() or dlsym(). | |
Public Attributes | |
| void * | h |
| The module handle. | |
Protected Attributes | |
| char * | err |
| The last error string, or NULL. | |
Definition at line 30 of file dynamic.h.
|
||||||||||||
|
This constructor loads the module using dlopen().
Definition at line 21 of file dynamic.cpp. 00022 { 00023 err = NULL; 00024 00025 if (!strstr(fname,".so")) 00026 { 00027 err = "This doesn't look like a module file to me..."; 00028 return; 00029 } 00030 00031 h = dlopen(fname, RTLD_NOW|RTLD_LOCAL); 00032 if (!h) 00033 { 00034 err = (char*)dlerror(); 00035 return; 00036 } 00037 }
|
|
|
Definition at line 39 of file dynamic.cpp. References h.
|
|
||||||||||||
|
Get a symbol using dynamic linking.
Definition at line 48 of file dynamic.cpp. Referenced by DLLFactoryBase::DLLFactoryBase(). 00049 { 00050 /* 00051 * try extract a symbol from the library 00052 * get any error message is there is any 00053 */ 00054 00055 if (h) 00056 { 00057 dlerror(); // clear value 00058 *v = dlsym(h, sym_name); 00059 err = (char*)dlerror(); 00060 if (!*v || err) 00061 return false; 00062 } 00063 00064 /* succeeded :) */ 00065 return true; 00066 }
|
|
|
Get the last error from dlopen() or dlsym().
Definition at line 51 of file dynamic.h. Referenced by DLLFactoryBase::DLLFactoryBase(). 00052 { 00053 return err; 00054 }
|
|
|
The last error string, or NULL.
Definition at line 66 of file dynamic.h. Referenced by DLLManager(), and GetSymbol(). |
|
|
The module handle. This is OS dependent, on POSIX platforms it is a pointer to a function pointer (yes, really!) and on windows it is a library handle. Definition at line 60 of file dynamic.h. Referenced by DLLManager(), GetSymbol(), and ~DLLManager(). |