Secrets of C++ Scripting Bindings: Bridging Compile Time and Run Time
Talkat CppCon 2024 · on Wednesday, 2024-09-18· at 14:00· Cottonwood 8/9, 6700 North Gaylord Rockies Boulevard·
summary
Starts from first principles and actually builds a tiny scripting engine (complete, runnable 96-line engine) that registers C++ functions via template deduction, boxes values with std::any vs std::variant tradeoffs, and dispatches calls with a simple stack-based runtime. Covers practical limits: overload resolution costs, handling noexcept/const/ref qualifiers, static_casts for overloads, and why Lua/sol2 Swig pybind ChaiScript approaches differ. Includes CompilerExplorer link and runnable example.
AI-written summary · about
chapters (29)
- 0:00Introduction
- 1:48Why this talk
- 3:36SWIG overview and limits
- 7:21ChaiScript intro and features
- 9:47Minimal ChaiScript example
- 12:37Conexper evolution
- 14:05Goals of demo
- 15:30Scripting engine interface
- 21:35Function pointers and qualifiers
- 27:39Function binding evolution
- 31:52Generic function storage types
- 35:26Function registration system
- 36:54Generic function invokers
- 40:54Function names and arity tracking
- 41:59Invoking runtime functions
- 43:22Compile-time knowledge importance
- 44:56Stack-based execution
- 46:19Stack language rules
- 47:22Void return handling
- 49:13Overloading challenges
- 50:16Stack management execution
- 51:40Script parsing to commands
- 52:0496-line engine demo
- 53:27Performance and data structures
- 55:18Overloading strategies
- 57:51Type-based overloading
- 58:55SWIG overload resolution
- 59:18Homework and improvements
- 1:00:01Q&A
related talks
01h 01mScripting at the Speed of Thought: Lua and C++ with sol3
01h 00m“Practical Performance Practices"
30mInteractive C++ Compilation (REPL) Done in a Tiny and Embeddable Way
01h 11mPragmatic Simplicity - Actionable Guidelines To Tame Cpp Complexity
06mLightning Talk: I Wrote a C++ REPL in 20 Lines of Code - And so can you!
53mDebug C++ Without Running
01h 06mCommand Line C++ Development
40mLessons from two decades of writing bad code
