-
Notifications
You must be signed in to change notification settings - Fork 160
Embedding HashLink
.RYEN edited this page Jan 7, 2025
·
3 revisions
HashLink can be easily embedded into any application to provide very fast scripting capabilities.
It consists of separate parts:
-
libhl
is the HashLink runtime, that can be dynamically linked - HL boot, with its bytecode loader
code.c
, module initializermodule.c
, jit supportjit.c
, and (optional) debuggerdebugger.c
All of these are initialized and controlled by main.c
which does the following:
- parse command-line arguments
- load the
.hl
bytecode - initialize HL runtime
- allocate and initialize a module (jit the code)
- setup exception catching
- call module entry point (starts it)
- catch and print exceptions (if any)
You can see the full source for it here.
If your program does not define a single/main entry point for Haxe. Please keep a few things in mind.
- Calling the entry point of a module is not optional. It sets up the global state of your virtual machine.
You can read the C API Documentation for more details about how to integrate with your application.