Skip to content

Instantly share code, notes, and snippets.

@naltun
Last active January 28, 2020 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naltun/cc7924a6f8f421a94cd7713b06bff543 to your computer and use it in GitHub Desktop.
Save naltun/cc7924a6f8f421a94cd7713b06bff543 to your computer and use it in GitHub Desktop.
// The code
const http = @import("http.zig");
const std = @import("std");
const warn = std.debug.warn;
const libcurl = @cImport(@cInclude("/usr/include/curl/curl.h"));
pub fn main() void {
var curl: *libcurl.CURL = libcurl.curl_easy_init();
var res: libcurl.CURLcode = undefined;
var url = "https://example.com";
libcurl.curl_easy_setopt(curl, libcurl.CURLOPT_URL, url);
res = libcurl.curl_easy_perform(curl);
libcurl.curl_easy_cleanup(curl);
warn("Success!\n");
}
// The output from `make'
/vagrant/test/src/main.zig:20:43: error: expected type '.cimport:13:17.CURLoption', found 'comptime_int'
libcurl.curl_easy_setopt(curl, libcurl.CURLOPT_URL, url);
^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment