void *GetExternalModuleAddrEx (int moduleID, const char name[], int *status, int options, char buffer[], unsigned int bufferSize);
Obtains the address of an identifier in a module that was loaded using LoadExternalModule. The identifier must be either a variable or function name defined globally in the external module.
If this function succeeds, it returns the address of the variable or function in the module and sets the status parameter to zero. If this function fails, it returns NULL and sets the status parameter to a negative error code.
Use GetExternalModuleAddrEx to get the list of undefined symbols if the function fails because there are undefined symbols.
![]() |
Note For global variables exported by a DLL, you have to use the name of the import symbol. For example, if the DLL exports a variable global, you have to pass __imp_global. In this case GetExternalModuleAddrEx returns a pointer to a pointer to the variable. Even though you can access global variables exported by a DLL through GetExternalModuleAddrEx as described above, the preferred mechanism is to provide a pair of Set and Get functions. |
Input | ||||||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||||||
moduleID | integer | The value returned by LoadExternalModule. | ||||||||||||||||||||||
name | const [] | The name of the identifier whose address is to be obtained from the external module. | ||||||||||||||||||||||
options | integer | Pass GETEXTMODADDR_OPTIONS_LIST_UNDEFINED to obtain a list of the undefined symbols if this function fails because of undefined symbols. Pass 0 if you do not want the list of undefined symbols. |
||||||||||||||||||||||
bufferSize | unsigned integer | The size, in bytes, of the buffer passed in the buffer parameter. | ||||||||||||||||||||||
Output | ||||||||||||||||||||||||
Name | Type | Description | ||||||||||||||||||||||
status | integer (passed by reference) | The status of the call to GetExternalModuleAddrEx. If GetExternalModuleAddrEx succeeds, it sets this parameter to zero. If GetExternalModuleAddrEx fails, it sets this parameter to a negative error code.
| ||||||||||||||||||||||
buffer | string | The buffer in which data is returned. The contents of the buffer are determined by the options parameter. If you pass GETEXTMODADDR_OPTIONS_LIST_UNDEFINED in the options parameter, this buffer is filled with the list of undefined symbols if the function fails because there are undefined symbols. Use a comma to delimit the symbols. If the list of symbols does not fit in the buffer, the list is truncated to the size of the buffer. |
Name | Type | Description |
address | The address of the identifier in the external module. If the identifier is a function, you normally assign the return value to a function pointer. If the function has a calling convention that differs from the default calling convention, you must include the calling convention in the declaration of the function pointer variable. Assume that the following function is declared in the external module: int __stdcall SetADouble (double d); If the default calling convention for this example is __cdecl, declare the function pointer as follows: int (__stdcall * SetADouble_FnPtr)(double) = NULL; To determine the default calling convention, select Options»Build Options in the Workspace window. |