home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 May / Pcwk5b98.iso / WEBSERVE / PI3 / PI3WEB.EXE / DEVEL / INCLUDE / PIDLL.H < prev    next >
C/C++ Source or Header  |  1997-10-19  |  6KB  |  212 lines

  1. /*____________________________________________________________________________*\
  2.  *
  3.  
  4.  Copyright (c) 1997 John Roy. All rights reserved.
  5.  
  6.  These sources, libraries and applications are
  7.  FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
  8.  as long as the following conditions are adhered to.
  9.  
  10.  Redistribution and use in source and binary forms, with or without
  11.  modification, are permitted provided that the following conditions
  12.  are met:
  13.  
  14.  1. Redistributions of source code must retain the above copyright
  15.     notice, this list of conditions and the following disclaimer. 
  16.  
  17.  2. Redistributions in binary form must reproduce the above copyright
  18.     notice, this list of conditions and the following disclaimer in
  19.     the documentation and/or other materials provided with the
  20.     distribution.
  21.  
  22.  3. Redistributions of any form whatsoever and all advertising materials 
  23.     mentioning features must contain the following
  24.     acknowledgment:
  25.     "This product includes software developed by John Roy
  26.     (http://www.johnroy.com/pi3/)."
  27.  
  28.  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  29.  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  30.  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  31.  IN NO EVENT SHALL THE AUTHORS OR ITS CONTRIBUTORS BE LIABLE FOR ANY
  32.  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  33.  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
  34.  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35.  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  36.  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  37.  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  38.  OF THE POSSIBILITY OF SUCH DAMAGE.
  39.  
  40.  *____________________________________________________________________________*|
  41.  *
  42.  * $Source: PIDLL.h$
  43.  * $Date: Sun Aug 10 06:29:34 1997$
  44.  *
  45.  Description:
  46. \*____________________________________________________________________________*/
  47. /* $HeaderTop:$ */
  48.  
  49. #ifndef PIDLL_H_
  50. #define PIDLL_H_
  51.  
  52. #include "PiAPI.h"
  53.  
  54. /*____________________________________________________________________________*\
  55.  *
  56.  Typedefs:
  57. \*____________________________________________________________________________*/
  58. typedef struct DLL PIDLL;
  59.  
  60. /*____________________________________________________________________________*\
  61.  *
  62.  Name:
  63.     PIDLL_new
  64.  
  65.  Synopsis:
  66.     PIDLL *PIDLL_new( const char *pPath )
  67.  
  68.  Description:
  69.     Create a new dynamic link library object by loading the
  70.     library pointed to by pPath.
  71.  
  72.  Notes:
  73.  Return Values:
  74.     On success PIDLL_new returns a pointer to a new dynamic link
  75.     library.
  76.  
  77.  Errors:
  78.     If pPath is NULL or memory cannot be allocated PIDLL_new() will
  79.     return NULL.
  80.  
  81.     More specific error information can be retrieved using
  82.     PIPlatform_getLastError().
  83.  
  84.  See Also:
  85.     PIDLL_delete().
  86. \*____________________________________________________________________________*/
  87. PUBLIC_PIAPI PIDLL *PIDLL_new( const char *pPath );
  88.  
  89. /*____________________________________________________________________________*\
  90.  *
  91.  Name:
  92.     PIDLL_isLoaded
  93.  
  94.  Synopsis:
  95.     int PIDLL_isLoaded( const PIDLL *pDLL )
  96.  
  97.  Description:
  98.     Indicates whether or not a new DLL object actually represents
  99.     a loaded dynamic link library.
  100.  
  101.  Notes:
  102.  Return Values:
  103.     PIDLL_isLoaded() returns either PIAPI_TRUE or PIAPI_FALSE. If
  104.     PIAPI_FALSE is returned and no error code is set (see below), the
  105.     function PIDLL_getErrorDescription() can be used to get a
  106.     text description of the reason the library could not be loaded.
  107.  
  108.  Errors:
  109.     On error PIDLL_isLoaded() returns PIAPI_FALSE and sets the
  110.     error code to a value other than PIAPI_COMPLETED. This error
  111.     code may be retrieved using PIPlatform_getLastError().
  112.  
  113.  See Also:
  114.     PIDLL_new().
  115. \*____________________________________________________________________________*/
  116. PUBLIC_PIAPI int PIDLL_isLoaded( const PIDLL *pDLL );
  117.  
  118. /*____________________________________________________________________________*\
  119.  *
  120.  Name:
  121.     PIDLL_delete
  122.  
  123.  Synopsis:
  124.     int PIDLL_delete( PIDLL *pDLL )
  125.  
  126.  Description:
  127.     Destroys and free memory associated with the dynamic link object
  128.     pDLL.
  129.  
  130.  Notes:
  131.     Whether or not the DLL is unloaded from the address space of
  132.     the process is implementation specific. Typically a DLL only
  133.     becomes unloaded when the load reference count reaches zero.
  134.  
  135.  Return Values:
  136.     On success PIDLL_delete() returns zero (PIAPI_COMPLETED).
  137.  
  138.  Errors:
  139.     On error PIDLL_delete() returns a negative value.
  140.  
  141.     More specific error information can be retrieved using
  142.     PIPlatform_getLastError().
  143.  
  144.  See Also:
  145.     PIDLL_new()
  146. \*____________________________________________________________________________*/
  147. PUBLIC_PIAPI int PIDLL_delete( PIDLL *pDLL );
  148.  
  149. /*____________________________________________________________________________*\
  150.  *
  151.  Name:
  152.     PIDLL_getAddress
  153.  
  154.  Synopsis:
  155.     void *PIDLL_getAddress( PIDLL *pDLL, const char *pSymbolName )
  156.  
  157.  Description:
  158.     Returns the address of symbol pSymbolName is the DLL pDLL.
  159.  
  160.  Notes:
  161.     This function is intended primarily for retrieving the address
  162.     of functions with "C" linkage.
  163.  
  164.  Return Values:
  165.     On success PIDLL_getAddress() returns a pointer to the memory
  166.     address of the required symbol.
  167.  
  168.  Errors:
  169.     PIDLL_getAddress returns NULL if the address of the function
  170.     could not be retrieved.
  171.  
  172.     More specific error information can be retrieved using
  173.     PIPlatform_getLastError().
  174.  
  175.     Additionally the PIDLL_getErrorDescription() can be used to get
  176.     an english description of the last error.
  177.  
  178.  See Also:
  179. \*____________________________________________________________________________*/
  180. PUBLIC_PIAPI void *PIDLL_getAddress( PIDLL *pDLL, const char *pSymbolName );
  181.  
  182. /*____________________________________________________________________________*\
  183.  *
  184.  Name:
  185.     PIDLL_getErrorDescription
  186.  
  187.  Synopsis:
  188.     const char *PIDLL_getErrorDescription( const PIDLL *pDLL )
  189.  
  190.  Description:
  191.     Returns an english description of the last error which 
  192.     occurred when performing a DLL operation.    
  193.  
  194.  Notes:
  195.     The error message string is allocate by the DLL object and
  196.     is invalided by invoking another operation on that DLL or
  197.     destroying the DLL object with PIDLL_delete().
  198.  
  199.  Return Values:
  200.     PIDLL_getErrorDescription() always returns an error 
  201.     description.
  202.  
  203.  Errors:
  204.     None.
  205.  
  206.  See Also:
  207. \*____________________________________________________________________________*/
  208. PUBLIC_PIAPI const char *PIDLL_getErrorDescription( const PIDLL *pDLL );
  209.  
  210. #endif    /* PIDLL_H_ */
  211.  
  212.