mirror of https://github.com/YosysHQ/yosys.git
Various win32 build fixes in yosys.cc
This commit is contained in:
parent
ee5165c6e4
commit
986bcc13cb
|
@ -24,7 +24,10 @@
|
||||||
# include <readline/history.h>
|
# include <readline/history.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -55,8 +58,22 @@ std::string vstringf(const char *fmt, va_list ap)
|
||||||
std::string string;
|
std::string string;
|
||||||
char *str = NULL;
|
char *str = NULL;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
int sz = 64, rc;
|
||||||
|
while (1) {
|
||||||
|
va_list apc;
|
||||||
|
va_copy(apc, ap);
|
||||||
|
str = (char*)realloc(str, sz);
|
||||||
|
rc = vsnprintf(str, sz, fmt, apc);
|
||||||
|
va_end(apc);
|
||||||
|
if (rc >= 0 && rc < sz)
|
||||||
|
break;
|
||||||
|
sz *= 2;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (vasprintf(&str, fmt, ap) < 0)
|
if (vasprintf(&str, fmt, ap) < 0)
|
||||||
str = NULL;
|
str = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
string = str;
|
string = str;
|
||||||
|
@ -163,8 +180,10 @@ void yosys_shutdown()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
for (auto &it : loaded_plugins)
|
for (auto &it : loaded_plugins)
|
||||||
dlclose(it.second);
|
dlclose(it.second);
|
||||||
|
#endif
|
||||||
|
|
||||||
loaded_plugins.clear();
|
loaded_plugins.clear();
|
||||||
loaded_plugin_aliases.clear();
|
loaded_plugin_aliases.clear();
|
||||||
|
@ -295,6 +314,12 @@ std::string proc_self_dirname ()
|
||||||
buflen--;
|
buflen--;
|
||||||
return std::string(path, buflen);
|
return std::string(path, buflen);
|
||||||
}
|
}
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
std::string proc_self_dirname()
|
||||||
|
{
|
||||||
|
#warning Fixme: Implement proc_self_dirname() for win32.
|
||||||
|
log_error("proc_self_dirname() is not implemented for win32 yet!\n");
|
||||||
|
}
|
||||||
#elif defined(EMSCRIPTEN)
|
#elif defined(EMSCRIPTEN)
|
||||||
std::string proc_self_dirname()
|
std::string proc_self_dirname()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue