# dynalink.h

Go to the documentation of this file.

    00001 /*
    00002  * dynalink.h
    00003  *
    00004  * Dynamic Link Library abstraction class.
    00005  *
    00006  * Portable Windows Library
    00007  *
    00008  * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
    00009  *
    00010  * The contents of this file are subject to the Mozilla Public License
    00011  * Version 1.0 (the "License"); you may not use this file except in
    00012  * compliance with the License. You may obtain a copy of the License at
    00013  * http://www.mozilla.org/MPL/
    00014  *
    00015  * Software distributed under the License is distributed on an "AS IS"
    00016  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
    00017  * the License for the specific language governing rights and limitations
    00018  * under the License.
    00019  *
    00020  * The Original Code is Portable Windows Library.
    00021  *
    00022  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
    00023  *
    00024  * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
    00025  * All Rights Reserved.
    00026  *
    00027  * Contributor(s): ______________________________________.
    00028  *
    00029  * $Revision: 24177 $
    00030  * $Author: rjongbloed $
    00031  * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
    00032  */
    00033
    00034 #ifndef PTLIB_DYNALINK_H
    00035 #define PTLIB_DYNALINK_H
    00036
    00037 #if !defined(P_RTEMS)
    00038
    00039 #ifdef P_USE_PRAGMA
    00040 #pragma interface
    00041 #endif
    00042
    00051 class PDynaLink : public PObject
    00052 {
    00053   PCLASSINFO(PDynaLink, PObject);
    00054
    00055   public:
    00061     PDynaLink();
    00065     PDynaLink(
    00066       const PString & name
    00067     );
    00068
    00071     ~PDynaLink();
    00073
    00076     /* Open a new dyna-link, loading the specified module.
    00077
    00078        @return
    00079        true if the library was loaded.
    00080      */
    00081     virtual PBoolean Open(
    00082       const PString & name
    00083     );
    00084
    00087     virtual void Close();
    00088
    00091     virtual PBoolean IsLoaded() const;
    00092
    00102     virtual PString GetName(
    00103       PBoolean full = false
    00104     ) const;
    00105
    00111     static PString GetExtension();
    00113
    00116
    00117     typedef void (*Function)();
    00118
    00119
    00125     PBoolean GetFunction(
    00126       PINDEX index,
    00127       Function & func
    00128     );
    00129
    00135     PBoolean GetFunction(
    00136       const PString & name,
    00137       Function & func
    00138     );
    00139
    00141     const PString & GetLastError() const { return m_lastError; }
    00143
    00144   protected:
    00145     PString m_lastError;
    00146
    00147 // Include platform dependent part of class
    00148 #ifdef _WIN32
    00149 #include "msos/ptlib/dynalink.h"
    00150 #else
    00151 #include "unix/ptlib/dynalink.h"
    00152 #endif
    00153 };
    00154
    00155 #endif // !defined(P_RTEMS)
    00156
    00157
    00158 #endif //PTLIB_DYNALINK_H
    00159
    00160
    00161 // End Of File ///////////////////////////////////////////////////////////////