5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2007 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 /****h* silcutil/Shared Object Interface
24 * Platform independent iterface for loading and using shared objects and
25 * dynamically linked libraries (DLLs).
32 /****s* silcutil/SilcDLLAPI/SilcDll
36 * typedef void *SilcDll;
40 * This context represents the shared object and it is allocated by
41 * silc_dll_load and is destroyed with silc_dll_close functions.
42 * The context is given as argument to all funtions in this interface.
46 typedef void *SilcDll;
48 typedef HMODULE SilcDll;
50 typedef void *SilcDll;
51 #endif /* SILC_UNIX */
53 /****f* silcutil/SilcDLLAPI/silc_dll_load
57 * SilcDll silc_dll_load(const char *object_path);
61 * Load shared object or DLL indicated by the `object_path'. The path
62 * must include the absolute path to the object and the object name.
63 * Returns the SilcDll context or NULL on error. The actual error
64 * message may be available by calling silc_dll_error function. Symbols
65 * may be retrieved from the returned context by calling silc_dll_getsym.
68 SilcDll silc_dll_load(const char *object_path);
70 /****f* silcutil/SilcDLLAPI/silc_dll_close
74 * void silc_dll_close(SilcDll dll);
78 * Closes the shared object indicated by `dll'. Any symbol retrieved
79 * from the `dll' with silc_dll_getsym will become invalid and cannot
83 void silc_dll_close(SilcDll dll);
85 /****f* silcutil/SilcDLLAPI/silc_dll_getsym
89 * void *silc_dll_getsym(SilcDll dll, const char *symbol);
93 * Returns the memory address of the symbol indicated by `symbol' from
94 * the shared object indicated by `dll'. If such symbol does not exist
98 void *silc_dll_getsym(SilcDll dll, const char *symbol);
100 /****f* silcutil/SilcDLLAPI/silc_dll_error
104 * const char *silc_dll_error(SilcDll dll);
108 * This routine may return error string after an error has occured with
109 * the shared object indicated by `dll'. If error string is not available
110 * this will return NULL.
113 const char *silc_dll_error(SilcDll dll);
115 #endif /* SILCDLL_H */