#include <dynamic_loader.h>
Inheritance diagram for library_plugins::dynamic_library_loader:


Public Types | |
| typedef void | shared_method () |
| a simple function prototype that can be cast to the real method. | |
Public Member Functions | |
| dynamic_library_loader (const istring &dll_name, bool load_it=true) | |
| loads the shared library with the "dll_name". | |
| virtual | ~dynamic_library_loader () |
| bool | load_the_library () |
| does the real work for loading the library. | |
| bool | loaded () const |
| returns true if the library successfully loaded with the name given. | |
| const istring & | dll_name () const |
| returns the name of the library. | |
| virtual_library * | create (vl_data_pack ¶meters) |
| returns a virtual library for *this* shared library, if possible. | |
| virtual void * | load_library (const char *to_load) |
| loads the library named "to_load". | |
| virtual void | free_library (void *to_free) |
| frees the library named "to_free". | |
Static Public Member Functions | |
| static shared_method * | load_method (void *handle, const char *method_name) |
| retrieves the function with "method_name" from the dll "handle". | |
Definition at line 28 of file dynamic_loader.h.
| typedef void library_plugins::dynamic_library_loader::shared_method() |
a simple function prototype that can be cast to the real method.
Definition at line 69 of file dynamic_loader.h.
| library_plugins::dynamic_library_loader::dynamic_library_loader | ( | const istring & | dll_name, | |
| bool | load_it = true | |||
| ) |
loads the shared library with the "dll_name".
the loaded() function returns true if the library was found and successfully attached to. the "load_it" flag can be used to delay loading until later by calling load_the_library(); this is mainly useful for derived versions of the loader, which must postpone loading until the object is fully constructed.
Definition at line 35 of file dynamic_loader.cpp.
References load_the_library().
| library_plugins::dynamic_library_loader::~dynamic_library_loader | ( | ) | [virtual] |
| bool library_plugins::dynamic_library_loader::load_the_library | ( | ) |
does the real work for loading the library.
this is called by the constructor if "load_it" was passed as true. otherwise the user must explicitly invoke this method.
Definition at line 48 of file dynamic_loader.cpp.
References load_library(), and istring::s().
Referenced by dynamic_library_loader(), and library_plugins::mfc_library_loader::mfc_library_loader().
| bool library_plugins::dynamic_library_loader::loaded | ( | ) | const |
returns true if the library successfully loaded with the name given.
Definition at line 65 of file dynamic_loader.cpp.
Referenced by create().
| const istring & library_plugins::dynamic_library_loader::dll_name | ( | ) | const |
| virtual_library * library_plugins::dynamic_library_loader::create | ( | vl_data_pack & | parameters | ) |
returns a virtual library for *this* shared library, if possible.
a specialized function for interpreting this shared library as a virtual_library; if the creation method can be found and called successfully, the returned object can be dynamically cast to the expected library type. the shared library must implement the virtual_library interface for this to be successful.
Definition at line 107 of file dynamic_loader.cpp.
References load_method(), loaded(), NIL, and STATIC_CREATE_INSTANCE_NAME.
| void * library_plugins::dynamic_library_loader::load_library | ( | const char * | to_load | ) | [virtual] |
loads the library named "to_load".
this class's implementations use the OS API functions for loading and freeing the library. it is necessary to override load_library and free_library for an MFC application in windoze, since loading an MFC dynamic library can corrupt the internal MFC state.
Reimplemented in library_plugins::mfc_library_loader.
Definition at line 67 of file dynamic_loader.cpp.
References NIL.
Referenced by load_the_library().
| void library_plugins::dynamic_library_loader::free_library | ( | void * | to_free | ) | [virtual] |
frees the library named "to_free".
Reimplemented in library_plugins::mfc_library_loader.
Definition at line 78 of file dynamic_loader.cpp.
Referenced by ~dynamic_library_loader().
| dynamic_library_loader::shared_method * library_plugins::dynamic_library_loader::load_method | ( | void * | handle, | |
| const char * | method_name | |||
| ) | [static] |
retrieves the function with "method_name" from the dll "handle".
Definition at line 93 of file dynamic_loader.cpp.
References NIL.
Referenced by create().
1.5.1