Skip to content

Commit 986949e

Browse files
committed
- realpath is not present in MinGW, use the one in omc_msvc.h/omc_msvc.c
omc_msvc.* should maybe renamed to omc_win.* later. git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15131 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
1 parent cd8bbbd commit 986949e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

SimulationRuntime/c/ModelicaExternalC/ModelicaInternal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void ModelicaNotExistError(const char* name) {
109109
# include <direct.h>
110110
# include <sys/types.h>
111111
# include <sys/stat.h>
112-
char *realpath(const char *path, char *resolved_path); /* define realpath */
112+
# include "omc_msvc.h" /* for realpath */
113113
# if defined(__MINGW32__) /* mingw has dirent */
114114
# include <sys/types.h>
115115
# include <dirent.h>

SimulationRuntime/c/util/omc_msvc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ int asprintf(char **strp, const char *fmt, ...) {
4848
}
4949
#endif
5050

51-
#if defined(_MSC_VER)
51+
#if defined(__MINGW32__) || defined(_MSC_VER)
5252
#include <stdlib.h>
53+
#include <string.h>
5354
char *realpath(const char *path, char *resolved_path) {
5455
char buffer[_MAX_PATH];
5556
if ( _fullpath(resolved_path ? resolved_path : buffer, path, _MAX_PATH ) != NULL ) {

SimulationRuntime/c/util/omc_msvc.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,8 @@ int asprintf(char **strp, const char *fmt, ...);
7171

7272
#endif
7373

74+
#if defined(__MINGW32__)
75+
char *realpath(const char *path, char *resolved_path);
76+
#endif
77+
7478
#endif

0 commit comments

Comments
 (0)