ENH: Also look into data segment (consistant with other implementation)

This commit is contained in:
Mathieu Malaterre 2006-03-11 09:47:41 -05:00
parent 6f3ef5aa92
commit 347efdedd5
1 changed files with 5 additions and 1 deletions

View File

@ -80,7 +80,11 @@ DynamicLoader::GetSymbolAddress(LibHandle lib, const char* sym)
void* addr; void* addr;
int status; int status;
status = shl_findsym (&lib, sym, TYPE_PROCEDURE, &addr); /* TYPE_PROCEDURE Look for a function or procedure.
* TYPE_DATA Look for a symbol in the data segment (for example, variables).
* TYPE_UNDEFINED Look for any symbol.
*/
status = shl_findsym (&lib, sym, TYPE_UNDEFINED, &addr);
void* result = (status < 0) ? (void*)0 : addr; void* result = (status < 0) ? (void*)0 : addr;
// Hack to cast pointer-to-data to pointer-to-function. // Hack to cast pointer-to-data to pointer-to-function.