#include <Windows.h>#include "BOOL.h"


Go to the source code of this file.
Defines | |
| #define | IMPORT_EXPORT_DYNAMICLIBRARY_DLL __declspec(dllimport) |
Typedefs | |
| typedef HINSTANCE | DynLibHandle |
| typedef FARPROC | DynLibFuncPtr |
Functions | |
| IMPORT_EXPORT_DYNAMICLIBRARY_DLL DynLibHandle | LoadDynLibrary (char *libname) |
| IMPORT_EXPORT_DYNAMICLIBRARY_DLL BOOL | FreeDynLibrary (DynLibHandle hInstance) |
| IMPORT_EXPORT_DYNAMICLIBRARY_DLL DynLibFuncPtr | GetDynLibFuncPtr (DynLibHandle hInstance, char *funcName) |
| IMPORT_EXPORT_DYNAMICLIBRARY_DLL char * | GetLastDynLibError (void) |
| #define IMPORT_EXPORT_DYNAMICLIBRARY_DLL __declspec(dllimport) |
Definition at line 22 of file dynamiclibrary_windows.h.
| typedef FARPROC DynLibFuncPtr |
Definition at line 26 of file dynamiclibrary_windows.h.
| typedef HINSTANCE DynLibHandle |
Definition at line 25 of file dynamiclibrary_windows.h.
| IMPORT_EXPORT_DYNAMICLIBRARY_DLL BOOL FreeDynLibrary | ( | DynLibHandle | hInstance | ) |
Decrements the reference count of the loaded dynamic-link library
| Handle | to the loaded library |
Definition at line 21 of file dynamiclibrary_others.c.
References FALSE, NULL, and TRUE.
00022 { 00023 if (hInstance) 00024 { 00025 if (dlclose( hInstance)) return TRUE; 00026 } 00027 #ifndef NDEBUG 00028 else 00029 { 00030 printf("FreeDynLibrary: Cannot close a not-opened library.\n"); 00031 fflush(NULL); 00032 } 00033 #endif 00034 00035 return FALSE; 00036 }
| IMPORT_EXPORT_DYNAMICLIBRARY_DLL DynLibFuncPtr GetDynLibFuncPtr | ( | DynLibHandle | hInstance, | |
| char * | funcName | |||
| ) |
Retrieves the address of an exported function
| Handle | to the loaded library | |
| string | that specifies the function |
| Handle | to the loaded library | |
| string | that specifies the function |
Definition at line 38 of file dynamiclibrary_others.c.
References NULL.
00039 { 00040 if (hInstance) 00041 { 00042 return dlsym(hInstance, funcName); 00043 } 00044 return NULL; 00045 }
| IMPORT_EXPORT_DYNAMICLIBRARY_DLL char* GetLastDynLibError | ( | void | ) |
return last dynamic linking error
Definition at line 37 of file dynamiclibrary_windows.c.
00038 { 00039 static char buffer[512]; 00040 DWORD dw = GetLastError(); 00041 DWORD source = 0; 00042 00043 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | 00044 FORMAT_MESSAGE_IGNORE_INSERTS, &source, dw, 0, 00045 buffer, 512, NULL) == 0) 00046 { 00047 strcpy(buffer, "Unknown Error"); 00048 } 00049 00050 return buffer; 00051 }
| IMPORT_EXPORT_DYNAMICLIBRARY_DLL DynLibHandle LoadDynLibrary | ( | char * | libname | ) |
Maps the specified executable module into the address space of the calling process
| name | of dynamic library |
Definition at line 15 of file dynamiclibrary_windows.c.
00016 { 00017 return (DynLibHandle) LoadLibrary(libname); 00018 }
1.5.5