Extend a C/C++ Project with Zig (2021)

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • ffmpeg

    FFmpeg Zig package (by andrewrk)

  • It's a bit more nuanced than that, as detailed by AndyKelley (andrewrk@) on github[1].

    As I understand it, C/C++ interop and support in the build system is not going away; instead it might be accomplished via a separately maintained clang package. (Aside: for an example of this kind of thing can work, see ffmpeg[2] converted to use the Zig build system which pulls in nasm[3] as a Zig package; presumably the clang solution would be a bit more integrated than that, but it serves to show that it can be done).

    Zig will still support compilation using LLVM, but instead of directly linking to LLVM and using LLVM's IRBuilder API, it will directly output LLVM bitcode instead[4]. The build system will then handle linking this into an executable.

    The idea seems to be to reduce dependencies of the main executable, while keeping the build system flexible enough that it does not impact existing use cases.

    I'm not affiliated with the Zig project in anyway, so my understanding of this may be off. I'd recommend reading the GH issues and comments I've linked below to get a better idea of it.

    [1]: https://github.com/ziglang/zig/issues/16270#issuecomment-161...

    [2]: https://github.com/andrewrk/ffmpeg

    [3]: https://github.com/andrewrk/nasm

    [4]: https://github.com/ziglang/zig/issues/13265

  • nasm

    nasm with the build system replaced by zig (by andrewrk)

  • It's a bit more nuanced than that, as detailed by AndyKelley (andrewrk@) on github[1].

    As I understand it, C/C++ interop and support in the build system is not going away; instead it might be accomplished via a separately maintained clang package. (Aside: for an example of this kind of thing can work, see ffmpeg[2] converted to use the Zig build system which pulls in nasm[3] as a Zig package; presumably the clang solution would be a bit more integrated than that, but it serves to show that it can be done).

    Zig will still support compilation using LLVM, but instead of directly linking to LLVM and using LLVM's IRBuilder API, it will directly output LLVM bitcode instead[4]. The build system will then handle linking this into an executable.

    The idea seems to be to reduce dependencies of the main executable, while keeping the build system flexible enough that it does not impact existing use cases.

    I'm not affiliated with the Zig project in anyway, so my understanding of this may be off. I'd recommend reading the GH issues and comments I've linked below to get a better idea of it.

    [1]: https://github.com/ziglang/zig/issues/16270#issuecomment-161...

    [2]: https://github.com/andrewrk/ffmpeg

    [3]: https://github.com/andrewrk/nasm

    [4]: https://github.com/ziglang/zig/issues/13265

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • zig

    General-purpose programming language and toolchain for maintaining robust, optimal, and reusable software.

  • to anyone considering Zig, note that its coming along pretty nicely, but still has some big missing parts. for example currently only TLS 1.3 is implemented, which means that HTTPS requests are going to fail with many servers:

    https://github.com/ziglang/zig/issues/14172

    I believe a 3rd party TLS package is available, but something to think about.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts