xHarbour Reference Documentation > Function Reference |
Retrieves the memory address of a function in a dynamically loaded DLL.
GetProcAddress( <nDllHandle>, ; <cFuncName>|<nOrdinal> ) --> pAddress
The function returns the memory address of <cFuncName> as a pointer. When the function cannot be found in the DLL, a null pointer is returned.
Function GetProcAddress() obtains the memory address of a DLL function after the DLL is loaded into memory with LoadLibrary(). The memory address of a function, also called function pointer, is sometimes required by API functions when they need to call other functions.
Note: the pointer returned by GetProcAddress() can be passed to function CallDll() which executes the function.
See also: | CallDll(), DllCall(), DllPrepareCall(), LoadLibrary() |
Category: | DLL functions , xHarbour extensions |
Source: | rtl\dllcall.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example demonstrates case sensitivity of function names // with DLL functions. PROCEDURE Main LOCAL nDll := LoadLibrary( "Kernel32.dll" ) ? GetProcAddress( nDll, "MultiByteToWideChar" ) // result: 7c809cad ? GetProcAddress( nDll, "MultibyteToWideChar" ) // result: 00000000 FreeLibrary( nDll ) RETURN
http://www.xHarbour.com