4. 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)Advanced 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.
- 4.1. Quick Start
- 4.2. C++ API Reference
- 4.3. C API Reference
- 4.3.1. When to use the C API
- 4.3.2. Initialization and shutdown
- 4.3.3. Text output
- 4.3.4. File access
- 4.3.5. Compilation
- 4.3.6. Simulation and context
- 4.3.7. Function evaluation
- 4.3.8. Argument helpers
- 4.3.9. Calling lambdas and blocks
- 4.3.10. Binding C functions
- 4.3.11. Binding types
- 4.3.12. String allocation
- 4.3.13. Context variables
- 4.3.14. Serialization
- 4.3.15. AOT checking
- 4.3.16. Module groups
- 4.3.17. Side effects
- 4.4. External Modules
- 4.4.1. Overview
- 4.4.2. Module types
- 4.4.3. The
.das_moduledescriptor - 4.4.4. Module resolution order
- 4.4.5. Building a C++ module
- 4.4.6. Building a pure daslang module
- 4.4.7. Using an external module from a host application
- 4.4.8. Installing external modules
- 4.4.9. Example: dascript-demo
- 4.4.10. In-tree modules vs external modules
- 4.5. Advanced Topics