ityonemo

ityonemo

Zigler - Zig nifs for Elixir

Currently just starting out on a new mini-project - getting zig NIFs to run in elixir.

https://github.com/ityonemo/zigler

The idea here is to make the zig NIFs be “embedded” in the elixir code, much like an “asm” call in C. It also makes the bridge between the zig function call and the elixir “basically transparent”. Several adapters are provided: i64, f64, string (as a c string or a zig slice), i64 arrays, f64 arrays. Of course it’s not terribly hard to do the unmarshalling of the erlang terms yourself inside the NIF.

Haven’t started documenting yet, but if you want to see how it works, the test/ directory has quite a few instructive examples which are all passing as of zig 0.4.0

Comments and criticism appreciated!

Most Liked

ityonemo

ityonemo

Updated to 0.8.1

Zig version is bumped to 0.8.1

Major highlights:

  • Supports cancellation of threaded and yielding nifs by killing the owning process.
  • When compiled with debug symbols, zig “error return traces” are merged with elixir exception stacktraces.
  • Supports idiomatic "std.testing.*’ zig stdlib functions for running zig tests
ityonemo

ityonemo

Zigler version 0.10.1 is released, with a redone API, fully updated documentation and guides.

Big highlight is “easy_c” which lets you mount a c library (or supplied c code) and allows you to integrate C libraries as nifs in an intuitive fashion without having to write error-prone glue code by hand.

https://hexdocs.pm/zigler/6-c_integration.html

ityonemo

ityonemo

Version 0.9.1 is released!

Zig version updated to 0.9.1:

Major highlights: Support for c and c++ compilation using the sources option:

Last Post!

venkatd

venkatd

We’ve been using Zigler/Zig in production and I love how seamless the experience is.

We opted for Zig over Rust for personal preferences. I think Zig is closer to C while Rust is closer to C++. We’re more C-kind of personality.

It also comes in handy when trying to integrate with 3rd party C libraries.

Where Next?

Popular in Announcing Top

mspanc
I am pleased to announce an initial release of the Membrane Framework - an Elixir-based framework with special focus on processing multim...
New
tmbb
I’ve decided to create this topic to discuss optimization possibilities for something like Phoenix LiveView. I’ve created this topic unde...
144 10789 141
New
kip
ex_cldr provides localisation and internationalisation support based upon the data from the Unicode CLDR project. Unicode released CLDR ...
407 13256 120
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
zachdaniel
Ash Framework What is Ash? Ash Framework is a declarative, resource-oriented application development framework for Elixir. A resource can...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44139 214
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement