Fix some Windows build issues.

This commit is contained in:
Stephen Williams 2019-03-22 08:08:29 -07:00
parent 9369d6db57
commit c3d5b23ac4
2 changed files with 14 additions and 2 deletions

View File

@ -195,4 +195,16 @@ inline int64_t i64round(double x)
#define TU ""
#endif
#ifdef __MINGW32__
# include <string.h>
static inline char*strndup(const char*s, size_t n)
{
if (strlen(s) < n) return strdup(s);
char*tmp = (char*)malloc(n);
strncpy(tmp, s, n);
tmp[n-1] = 0;
return tmp;
}
#endif
#endif /* IVL_config_H */

View File

@ -102,13 +102,13 @@ void vpip_add_env_and_default_module_paths()
s = strrchr(basepath, '\\');
if (s) *s = 0;
else {
fprintf(stderr, "%s: Missing first \\ in exe path!\n", argv[0]);
fprintf(stderr, "%s: Missing first \\ in exe path!\n", tmp);
exit(1);
}
s = strrchr(basepath, '\\');
if (s) *s = 0;
else {
fprintf(stderr, "%s: Missing second \\ in exe path!\n", argv[0]);
fprintf(stderr, "%s: Missing second \\ in exe path!\n", tmp);
exit(1);
}
strcat(s, "\\lib\\ivl" IVL_SUFFIX);