Problem
The kwxgen Go generator currently emits import "C" in every generated *_gen.go file:
// Code generated by kwxgen. DO NOT EDIT.
package wx
// #include "kwx_classes.h"
import "C"
With 200+ generated files, this means the Go toolchain launches 200+ separate C compiler invocations, each re-parsing the full kwx_classes.h header tree. CGo does not share parsed header state across files in the same package. On a 32-core machine the build is still extremely slow because the C compilation bottleneck dominates.
Expected Behavior
The generator should consolidate all C function declarations into a single generated file (e.g., cgo_glue_gen.go) that contains all the // extern ... declarations and a single import "C". The remaining *_gen.go files would contain only pure Go wrapper functions — no import "C" — and would call helpers/type-casted C pointers from the consolidated glue file.
This is the standard pattern for large CGo packages and reduces C compiler invocations from O(N files) to O(1).
Impact
- On a 32-core Windows machine,
go build of the wx package takes several minutes
- Nearly all of that time is redundant header parsing
- After consolidation, incremental and clean builds should be dramatically faster (seconds instead of minutes)
Problem
The kwxgen Go generator currently emits
import "C"in every generated*_gen.gofile:With 200+ generated files, this means the Go toolchain launches 200+ separate C compiler invocations, each re-parsing the full
kwx_classes.hheader tree. CGo does not share parsed header state across files in the same package. On a 32-core machine the build is still extremely slow because the C compilation bottleneck dominates.Expected Behavior
The generator should consolidate all C function declarations into a single generated file (e.g.,
cgo_glue_gen.go) that contains all the// extern ...declarations and a singleimport "C". The remaining*_gen.gofiles would contain only pure Go wrapper functions — noimport "C"— and would call helpers/type-casted C pointers from the consolidated glue file.This is the standard pattern for large CGo packages and reduces C compiler invocations from O(N files) to O(1).
Impact
go buildof thewxpackage takes several minutes