|
CLASS moModuleManager
NAME
Constructor - initialize the module manager
Destructor - free resources used by the module manager
GetModuleManager - get a pointer to the module manager
Done - close the module manager
VERSION
Version: 1.2.0
SYNOPSIS
static moModuleManagerSPtr GetModuleManager(void);
static void Done(void);
private:
moModuleManager(void);
~moModuleManager();
DESCRIPTION
The module manager is a singleton. You can get a pointer to
that object using the GetModuleManager. The first time the
function is being called, the module manager is created.
That very first call is NOT multi-thread safe. If you plan
to use multiple threads with the module manager, then you
most certainly want to call this function once before you
create your threads.
The constructor and destructor functions are both private
because the module manager will be created using the
GetModuleManager() function and destroyed once all the
references to the object are severed. The reference within
the module manager itself is removed when the Done() function
is called.
Brief example of usage:
int main()
{
{
moModuleManagerSPtr mm = moModuleManager::GetModuleManager();
mm->Load("My Dynamic Library");
}
moModuleManager::Done();
}
SEE ALSO
moPropBag::Get(), moPropBag::Set(), moPropBag::Delete()
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moModuleManager
NAME
Load - load the named module
Unload - unload the named module
LoadModules - load the list of modules which match a pattern
VERSION
Version: 1.2.0
SYNOPSIS
moModuleSPtr Load(const moWCString& name);
void Unload(moModule *module);
bool LoadModules(const moWCString& pattern);
PARAMETERS
name - the name of the module to be loaded
pattern - a shell like pattern to specify a list of modules to load
DESCRIPTION
The Load() function will search for the specified module.
If it finds it, then it simply AddRef() and return its
pointer. Otherwise, it will try to load it from disk.
The Unload() function Release() the module once. If the
module wasn't loaded more than once, then it is physically
unloaded from memory.
Note that trying to Unload() the same module more than once
will result in an assert(). This is a really bad error.
The Load() and Unload() functions are thread safe.
The LoadModules() will use the moDirectory object to read a
list of filenames. Then it will try to load each one of them
using the Load() function.
RETURN VALUE
The Load() function returns a pointer to the module loaded.
If an error occurs, the Load() function returns a null pointer.
The LoadModules() returns true when all the files matching the
pattern were successfully loaded. It will always try to load all
the modules. If one or more fails, the function returns false.
If there are no files found which match the pattern, the method
returns true. This means software which can run without any
modules can start with no error even when no extension modules
were installed.
SEE ALSO
GetModuleManager, moModule class
BUGS
The module manager assumes that you don't use the lt_dlopenext()
and lt_dlclose() functions outside of this library.
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moModuleManager
NAME
GetLastError - last error when trying to load a module
VERSION
Version: 1.2.0
SYNOPSIS
const moWCString& GetLastError(void) const;
DESCRIPTION
The GetLastError() function returns a humain readable string
which represents the error message that the last command which
generated an error has returned.
This error is not cleared. You can call this function multiple
times and the same string will be returned.
RETURN VALUE
A reference to the error string.
SEE ALSO
Load, Unload
WARNINGS
This function returns a reference. If you don't copy the string,
then calling the Load() function again can change that string.
BUGS
When the module manager is used in a multi-thread environment
the last error can be the error that another thread generated.
A future version of this object may save the last error on a
per thread basis.
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moModule
NAME
Name - returns the name of the moModule object
VERSION
Version: 1.2.0
SYNOPSIS
const moWCString& Name(void) const;
DESCRIPTION
The Name() function returns the name of the module as specified
in the constructor parameter list.
RETURN VALUE
Name() returns a constant reference to the module name string.
SEE ALSO
FindSymbol, MakeResident, GetLastError
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moModule
NAME
FindSymbol - search for the address of a specified symbol
VERSION
Version: 1.2.0
SYNOPSIS
bool FindSymbol(const moWCString& name, mo_symbol_ptr_t& pointer) const;
DESCRIPTION
Search this module for the specified symbol.
Note that the pointer to the symbol is specified as a parameter
and the result of the function will be true if it succeeded.
RETURN VALUE
The FindSymbol() function returns true whenever it finds the
specified symbol and false otherwise
If the symbol is not found, then a new error message will be
available in the module. Use the GetLastError() to retrieve
it.
SEE ALSO
MakeResident, GetLastError
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moModule
NAME
MakeResident - force the module to stay in memory
IsResident - whether the module is currently in memory
VERSION
Version: 1.2.0
SYNOPSIS
int MakeResident(void) const;
bool IsResident(void) const;
DESCRIPTION
The MakeResident() function ensures that the module stays in
memory. This is a good idea especially when the module is being
used over and over again.
The IsResident() tells you whether the module currently is in
memory or not.
RETURN VALUE
MakeResident() returns 0 when no error occured.
IsResident() returns true if the module is in memory.
SEE ALSO
FindSymbol, GetLastError
BUGS
The Macintosh version of ltdl available in fink doesn't
support residency information.
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moModule
NAME
GetLastError - get a string about the last error
VERSION
Version: 1.2.0
SYNOPSIS
const moWCString& GetLastError(void) const;
DESCRIPTION
The different functions in a module object can generate an
error. The error message can be retrieved with this function.
Calling this function more than once yields the same result.
In other words, the error isn't cleared.
RETURN VALUE
GetLastError() returns a constant reference to the last
error message produced by one of the module functions.
SEE ALSO
FindSymbol, MakeResident
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moInternalModule
NAME
Load_AddRef - add one to the reference
Load_Release - reduce the reference by one
VERSION
Version: 1.2.0
SYNOPSIS
unsigned long Load_AddRef(void);
unsigned long Load_Release(void);
DESCRIPTION
The module object has two reference counters. One counts
the number of times it was loaded with the Load()
instruction (see the moModuleManager) and one which is
used by the smart pointer template.
A module can be loaded multiple times using the Load()
instruction. For each time it was loaded, one needs to
call Unload() [WARNING: if the Done() function of the
manager is called, then the list of modules are anyway
released by the manager not doing anything specific
about the load counter].
NOTES
This counter is thread safe.
RETURN VALUE
The Load_AddRef() returns the counter after it added
one to it.
The Load_Release() returns the counter after it
subtracted one from it.
SEE ALSO
moModuleManager::Load, moModuleManager::Unload
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
CLASS
moInternalModule
NAME
Compare - compare two modules
VERSION
Version: 1.2.0
SYNOPSIS
virtual compare_t Compare(const moBase& object) const;
DESCRIPTION
This is used to compare two internal modules to sort
them in a list.
Modules are sorted by name. You can't have two modules
of the same name. Instead, when you try to load a module
and an entry with that name is found, that entry is
automatically returned (and it gets its Load() counter
increment).
RETURN VALUE
one of the compare_t results
SEE ALSO
Load_AddRef, Load_Release
COPYRIGHTS
This documentation and the code being documented is proprietary and cannot be duplicated without the express and written consent of Made to Order Software Coporation.
Copyright (c) 1999-2007 by Made to Order Software Corporation
All rights reserved.
AUTHORS
Alexis Wilke, Doug Barbieri
Links:
molib
the sandbox
|