View Source :zigler (zigler v0.14.0)
Parse transform module for using Zigler with erlang.
Prerequisites
In order to use Zigler in an erlang project, you must have the Elixir runtime. You may do this any way you wish, but Zigler recommends rebar_mix:
https://github.com/Supersonido/rebar_mix
There are instructions on how to make sure Elixir is available at compile time for your erlang project.
Building a Zig Module
General documentation on parse transforms is very light. To use zigler as a parse transform:
-module(my_erlang_module).
-compile({parse_transform, zigler}).
-export([...]).
-zig_code("
pub fn hello_world() [] const u8 {
return \"Hello, world!\";
}
")
-zig_opts([{otp_app, my_app}]).
This creates the hello_world/0
function in your
module which returns the "Hello, world!" binary.
for options to be delivered in the zig_opts
attribute, see the
Zig
module documentation.
Note that the ...
for the nifs
option is not representable in erlang AST.
Instead, use the tuple {auto, [<nifs options...>]}
Note
Erlang integration is experimental and the interface may be changed in the future.
Summary
Functions
performs a parse transformation on the AST for an erlang module, converting public functions in the zig code into erlang functions.
Functions
performs a parse transformation on the AST for an erlang module, converting public functions in the zig code into erlang functions.