-
Notifications
You must be signed in to change notification settings - Fork 6
Bindgens
VSL compiles to a variety of targets and given that large amounts of codebases are already written in other languages, it's important for VSL to be able to interact with these. For this purpose the VSL compiler toolchain supports 'bindgens' which are tools which allow native VSL code to interact with code in other languages.
Different languages require different things but in general a bindgen generates VSL files which mimic the API of the source language but provide an idiomatic VSL interface through classes and functions.
An example is the JavaScript bindgen. JavaScript classes are converted to VSL classes but also extend a JSObject
class to allow objects to mimic both VSL and JavaScript semantics.
Bindgens are native processes as part of the build toolchain, when you run vsl build
if not already generated, the 'bindgen' will generate files in some directory which should be included in the sources list and built with your module.
VSL has bindgens for various languages natively supported:
-
C (
c
): The C bindgen only supports C code but can perform more advanced analysis and produce things such classes etc. -
C++/Objective-C (
objc
): The ObjC bindgen supports Objective-C++ and thereby C++. It can compile Objective-C classes and C++ classes and fully supports runtime features such as dynamic dispatch subclassing, etc. One shortfall is generics/templates. -
JavaScript/TypeScript/WebIDL (
js
): The js bindgen processes WebIDL or TypeScript definition files and generates VSL code which can interact with it. This supports the VSL WASM dispatch API. The dispatch API is a standard libvsl series of variables, functions, and classes which allows flexible cross-language interaction.
- Introduction
- Installation
- VSL By Example
- Usage
- WASM (WebAssembly)
- The Basics
- Your First Program
- Syntax
- Concepts
- Modules
- Advanced Details
- Interop
- VSL Development
- Common Errors