Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #94 from juanjux/windows_fix
Browse files Browse the repository at this point in the history
Windows static lib support
  • Loading branch information
juanjux authored Nov 8, 2018
2 parents cc255a3 + 96c4e28 commit c2144f0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ ifneq ("$(HOSTOS)", "windows")
build-windows: $(DEPS_C) $(DEPS_GO)
mkdir -p $(OUT_WINDOWS)
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=$(CC_WIN64) $(GO_BUILD) $(BUILD_MODE) -o=$(OUT_WINDOWS)/$(OUT_NAME).dll $(SRC_DIR)/
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=$(CC_WIN64) $(GO_BUILD) $(BUILD_MODE_STATIC) -o=$(OUT_WINDOWS)/$(OUT_NAME).lib $(SRC_DIR)/
$(GEN_HEADER) $(OUT_WINDOWS)/$(OUT_HEADER)
$(CP_HEADERS) $(OUT_WINDOWS)/

Expand Down
13 changes: 12 additions & 1 deletion src/libuast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@
#include <iostream>
#include <cstring>

// Workaround for linking libs cross-compiled with gcc vs VS2015 libs
// See: https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2
#ifdef _WIN32
FILE _iob[] = {*stdin, *stdout, *stderr};

extern "C" FILE * __cdecl __iob_func(void)
{
return &(_iob[0]);
}
#endif

namespace uast {
struct Buffer {
Buffer(void* p, size_t sz) : ptr(p), size(sz) {}
Expand Down Expand Up @@ -599,4 +610,4 @@ namespace uast {
return dst->ToNode(n);
}
} // namespace uast
#endif // UAST_HPP_
#endif // UAST_HPP_

0 comments on commit c2144f0

Please sign in to comment.