loads a dynamic module from the binary path and returns a named function returns NULL, if something fails
| 1393 | // loads a dynamic module from the binary path and returns a named function |
| 1394 | // returns NULL, if something fails |
| 1395 | void* binary_module_function(const char* newlib, const char* funcname) |
| 1396 | { |
| 1397 | void* result = NULL; |
| 1398 | |
| 1399 | const char* bin_dir = feGetResource('b'); |
| 1400 | if (!bin_dir) { return NULL; } |
| 1401 | |
| 1402 | char path_name[MAXPATHLEN]; |
| 1403 | snprintf(path_name,MAXPATHLEN, "%s%s%s.%s", bin_dir, DIR_SEPP, newlib, MODULE_SUFFIX_STRING); |
| 1404 | |
| 1405 | void* openlib = dynl_open(path_name); |
| 1406 | if(!openlib) |
| 1407 | { |
| 1408 | Werror("dynl_open of %s failed:%s", path_name, dynl_error()); |
| 1409 | return NULL; |
| 1410 | } |
| 1411 | result = dynl_sym(openlib, funcname); |
| 1412 | if (!result) Werror("%s: %s\n", funcname, dynl_error()); |
| 1413 | |
| 1414 | return result; |
| 1415 | } |
| 1416 | #endif |
| 1417 | |
| 1418 | /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
nothing calls this directly
no test coverage detected