Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bind/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ package main
%[3]s
// #define Py_LIMITED_API // need full API for PyRun*
#include <Python.h>
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 202311L)
typedef uint8_t bool;
#endif
// static inline is trick for avoiding need for extra .c file
// the following are used for build value -- switch on reflect.Kind
// or the types equivalent
Expand Down Expand Up @@ -410,7 +412,7 @@ build:
$(GOIMPORTS) -w %[1]s.go
# this will otherwise be built during go build and may be out of date
- rm %[1]s.c
echo "typedef uint8_t bool;" > %[1]s_go.h
printf "#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 202311L)\ntypedef uint8_t bool;\n#endif\n" > %[1]s_go.h
# this will fail but is needed to generate the .c file that then allows go build to work
- $(PYTHON) build.py >/dev/null 2>&1
# generate %[1]s_go.h from %[1]s.go -- unfortunately no way to build .h only
Expand Down
2 changes: 1 addition & 1 deletion cmd_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func runBuild(mode bind.BuildMode, cfg *BuildCfg) error {

if mode == bind.ModeExe {
of, err := os.Create(buildname + ".h") // overwrite existing
fmt.Fprintf(of, "typedef uint8_t bool;\n")
fmt.Fprintf(of, "#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 202311L)\ntypedef uint8_t bool;\n#endif\n")
of.Close()

fmt.Printf("%v build.py # will fail, but needed to generate .c file\n", cfg.VM)
Expand Down
Loading