5. Embedding and Integration
This section explains how to embed the daslang scripting language into a host application written in C++ or C (and, by extension, any language that can call C functions). It is organized from simple to advanced:
Quick Start — minimal host program, compilation, and evaluation
C++ API Reference — modules, function/type/enum bindings, cast infrastructure
C API Reference — the
daslang/c_api/c_api.hheader for C-only hosts and FFIExternal Modules — building and distributing modules outside the main source tree,
.das_moduledescriptors,find_package(DAS)Project Files —
.das_projectfiles for custom module resolution and sandboxingAdvanced Topics — AOT compilation, standalone contexts, class adapters
For step-by-step walk-throughs with complete, compilable source code, see the C++ integration tutorials and C integration tutorials.
- 5.1. Quick Start
- 5.2. C++ API Reference
- 5.3. C API Reference
- 5.3.1. When to use the C API
- 5.3.2. Initialization and shutdown
- 5.3.3. Text output
- 5.3.4. File access
- 5.3.5. Compilation
- 5.3.6. Simulation and context
- 5.3.7. Function evaluation
- 5.3.8. Argument helpers
- 5.3.9. Calling lambdas and blocks
- 5.3.10. Binding C functions
- 5.3.11. Binding types
- 5.3.12. String allocation
- 5.3.13. Context variables
- 5.3.14. Type introspection
- 5.3.15. Serialization
- 5.3.16. AOT checking
- 5.3.17. Module groups
- 5.3.18. Side effects
- 5.4. External Modules
- 5.4.1. Overview
- 5.4.2. Module types
- 5.4.3. The
.das_moduledescriptor - 5.4.4. Module resolution order
- 5.4.5. Building a C++ module
- 5.4.6. Building a pure daslang module
- 5.4.7. Using an external module from a host application
- 5.4.8. Installing external modules
- 5.4.9. Example: dascript-demo
- 5.4.10. In-tree modules vs external modules
- 5.5. Project Files (.das_project)
- 5.6. Advanced Topics