{{ message }}
Using PowerShell as the host for Axmol's new C# binding generator #27964
Deal (halx99)
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Hi PowerShell community,
I’d like to share a real-world use of PowerShell from the Axmol Engine project.
In Axmol v3, we recently rewrote our Lua binding generation system:
Python + tolua++ → PowerShell + C# + libclang
PR: axmolengine/axmol#3301
What may be interesting here is that PowerShell is not just acting as a wrapper around another build tool.
The C# generator is compiled directly by PowerShell 7 using
Add-Typeand the Roslyn compiler available through PowerShell. This gives us a clean-host workflow that does not require developers to install or invoke the .NET SDK separately.The user-facing workflow is simply:
Internally, the PowerShell tooling:
Add-Type;ClangSharp.Interopwhen needed;libclangruntime on Windows, macOS, and Linux;The bootstrap is essentially built around this pattern:
The generator itself uses the libclang C API through
ClangSharp.Interopto inspect the real C++ AST and generate Lua bindings for classes, inheritance, overloads, default arguments, enums, selected fields, andstd::functioncallbacks.The architecture is roughly:
This separation worked very well for us.
PowerShell provides a single cross-platform entry point and a lightweight managed host, while C# handles the more complex AST transformation logic. Compared with the old Python-based generator, the new setup is easier for us to maintain, easier to verify, and much simpler to integrate into CI.
The generated files are checked into the repository, and CI regenerates them from the current C++ sources. If a C++ API changes without the Lua bindings being regenerated, the build can detect that automatically.
The rewrite now covers roughly 500 registered C++ classes across 15 modules and has completely replaced Axmol’s old tolua++ generation pipeline.
For anyone interested in the implementation:
tools/cmdline/plugins/genbindings.ps1tools/bindings-generator/src/For me, this was a good example of PowerShell being useful as more than a scripting shell: it can also serve as a practical cross-platform host for fairly substantial C# developer tooling.
I’d be interested to hear whether others are using
Add-Typein a similar way to host non-trivial C# tooling directly from PowerShell.All reactions