Skip to content

Commit

Permalink
- fixes for OMDev MinGW
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7171 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 24, 2010
1 parent acabe7b commit ba88cbb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -710,6 +710,12 @@ int file_select_directories(direntry entry)

#endif

#if defined(__MINGW32__) || defined(_MSC_VER)
#define getFunctionPointerFromDLL GetProcAddress
#else
#define getFunctionPointerFromDLL dlsym
#endif

extern int SystemImpl__lookupFunction(int libIndex, const char *str)
{
modelica_ptr_t lib = NULL, func = NULL;
Expand All @@ -721,11 +727,7 @@ extern int SystemImpl__lookupFunction(int libIndex, const char *str)
if (lib == NULL)
return -1;

#if defined(__MINGW32__) || defined(_MSC_VER)
funcptr = (void*)GetProcAddress(lib->data.lib, str);
#else
funcptr = (int (*)(type_description*, type_description*)) dlsym(lib->data.lib, str);
#endif
funcptr = (int (*)(type_description*, type_description*)) getFunctionPointerFromDLL(lib->data.lib, str);

if (funcptr == NULL) {
/*fprintf(stderr, "Unable to find `%s': %lu.\n", str, GetLastError());*/
Expand Down

0 comments on commit ba88cbb

Please sign in to comment.