Skip to content


Repository files navigation

libcurl build package


Like this project?

If you like this project or other works of mine, please consider donating to or sponsoring me on Github ❤️

How to use

This repo contains code for your build.zig that can statically compile libcurl, as well as some idiomatic Zig bindings for libcurl that you can use in your application. In either case below you will be able to include libcurls header with:

const c = @cImport({

Link and add bindings to your application

In order to statically link libcurl into your application and access the bindings with a configurable import string:

const libcurl = @import("path/to/libcurl.zig");

pub fn build(b: * void {
    // ...

    const lib = libcurl.create(b, target, optimize);

    const exe = b.addExecutable(.{
        .name = "my-program",
        .root_source_file = .{ .path = "src/main.zig" },
        .target = target,
        .optimize = optimize,
    const exe = b.addExecutable("my-program", "src/main.zig");, .{ .import_name = "curl" });

Now code that is part of the my-program executable can import the libcurl bindings with @import("curl").

Only link to your application

In order to just link to the application, all you need to do is omit the .import_name = "curl" argument to libcurl's link options:, .{});


No releases published

Sponsor this project




Contributors 4