dynalink.h
Go to the documentation of this file.
/*
* dynalink.h
*
* Dynamic Link Library abstraction class.
*
* Portable Windows Library
*
* Copyright (c) 1993-1998 Equivalence Pty. Ltd.
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Original Code is Portable Windows Library.
*
* The Initial Developer of the Original Code is Equivalence Pty. Ltd.
*
* Portions are Copyright (C) 1993 Free Software Foundation, Inc.
* All Rights Reserved.
*
* Contributor(s): ______________________________________.
*
* $Revision: 24177 $
* $Author: rjongbloed $
* $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
*/
#ifndef PTLIB_DYNALINK_H
#define PTLIB_DYNALINK_H
#if !defined(P_RTEMS)
#ifdef P_USE_PRAGMA
#pragma interface
#endif
class PDynaLink : public PObject
{
PCLASSINFO(PDynaLink, PObject);
public:
PDynaLink();
PDynaLink(
const PString & name
);
~PDynaLink();
/* Open a new dyna-link, loading the specified module.
@return
true if the library was loaded.
*/
virtual PBoolean Open(
const PString & name
);
virtual void Close();
virtual PBoolean IsLoaded() const;
virtual PString GetName(
PBoolean full = false
) const;
static PString GetExtension();
typedef void (*Function)();
PBoolean GetFunction(
PINDEX index,
Function & func
);
PBoolean GetFunction(
const PString & name,
Function & func
);
const PString & GetLastError() const { return m_lastError; }
protected:
PString m_lastError;
// Include platform dependent part of class
#ifdef _WIN32
#include "msos/ptlib/dynalink.h"
#else
#include "unix/ptlib/dynalink.h"
#endif
};
#endif // !defined(P_RTEMS)
#endif //PTLIB_DYNALINK_H
// End Of File ///////////////////////////////////////////////////////////////
PDynaLink::GetFunction
PBoolean GetFunction(PINDEX index, Function &func)
Get a pointer to the function in the dynamically loadable module.
PDynaLink::name
PString name
Definition: dynalink.h:40
PDynaLink::GetExtension
static PString GetExtension()
Get the extension used by this platform for dynamic link libraries.
PDynaLink::GetName
virtual PString GetName(PBoolean full=false) const
Get the name of the loaded library.
PDynaLink::Function
void(* Function)()
Primitive pointer to a function for a dynamic link module.
Definition: dynalink.h:117
PDynaLink::m_lastError
PString m_lastError
Definition: dynalink.h:145
PDynaLink::GetLastError
const PString & GetLastError() const
Definition: dynalink.h:141
PDynaLink::IsLoaded
virtual PBoolean IsLoaded() const
Dyna-link module is loaded and may be accessed.
PDynaLink::PDynaLink
PDynaLink()
Create a new dyna-link, loading the specified module.
PBoolean
BOOL PBoolean
Definition: object.h:102
PDynaLink::~PDynaLink
~PDynaLink()
Destroy the dyna-link, freeing the module.
PString
The character string class.
Definition: pstring.h:108
PDynaLink
A dynamic link library.
Definition: dynalink.h:51
PDynaLink::Close
virtual void Close()
Close the dyna-link library.
PObject
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
PDynaLink::Open
virtual PBoolean Open(const PString &name)