Skip to content

Commit

Permalink
- attempt to fix Windows build (vasprintf)
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@20082 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Apr 10, 2014
1 parent 1f88898 commit 5e248e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions SimulationRuntime/c/util/omc_msvc.c
Expand Up @@ -46,4 +46,12 @@ int asprintf(char **strp, const char *fmt, ...) {
va_end(ap);
return len;
}

int vasprintf(char **strp, const char *fmt, va_list ap) {
int len;
len = vsnprintf(NULL, 0, fmt, ap);
*strp = malloc(len+1);
len = vsnprintf(*strp, len+1, fmt, ap);
return len;
}
#endif
5 changes: 5 additions & 0 deletions SimulationRuntime/c/util/omc_msvc.h
Expand Up @@ -69,8 +69,10 @@ static union MSVC_FLOAT_HACK __NAN = {{0x00, 0x00, 0xC0, 0x7F}};
#endif

#define PATH_MAX _MAX_PATH
#include <stdarg.h>
char *realpath(const char *path, char *resolved_path);
int asprintf(char **strp, const char *fmt, ...);
int vasprintf(char **strp, const char *fmt, va_list ap);

#else /* not msvc */

Expand All @@ -80,7 +82,10 @@ int asprintf(char **strp, const char *fmt, ...);
#endif /* end msvc */

#if defined(__MINGW32__)
#include <stdarg.h>
char *realpath(const char *path, char *resolved_path);
int asprintf(char **strp, const char *fmt, ...);
int vasprintf(char **strp, const char *fmt, va_list ap);
#endif

/* for non GNU compilers */
Expand Down

0 comments on commit 5e248e5

Please sign in to comment.