~ioiojo/export-anytype

Example template for exporting C library from Zig for C/Go applications

refs

master
browse  log 

clone

read-only
https://git.sr.ht/~ioiojo/export-anytype
read/write
git@git.sr.ht:~ioiojo/export-anytype

You can also use your local clone with git send-email.

#export-anytype

Example template for exporting C library from Zig for consumption from downstream C and Go applications.

#Description

Cross-language interop with Zig can be done in the following ways:

  1. Write a C header by hand, and import this C header file into Zig, Go, etc (see: c-header/)

  2. Use the Lua C API - write Lua C module (see: lua-c-api/)

  3. Serialization, e.g. protobuf, msgpack, JSON (see: serialization/)

#Synopsis

#C header example

cd c-header

# run go example
just
./export-anytype

# run c example
just build-c
./main

#Lua C API example

Cgo-exported Lua C module example:

cd lua-c-api/cgo
just peru-sync
just run-zig

Zig-exported Lua C module example:

cd lua-c-api/zig
just peru-sync
just
./export-anytype

#Installation

#Test Dependencies

#License

Licensed under either of

at your option.

#Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Do not follow this link