https://github.com/doccaico/calc-zig
https://github.com/doccaico/calc-zig
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/doccaico/calc-zig
- Owner: doccaico
- Created: 2024-04-30T05:25:22.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T06:54:15.000Z (about 2 years ago)
- Last Synced: 2025-01-06T11:38:31.707Z (over 1 year ago)
- Language: Zig
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### Usage
On terminal
```
$ zig fetch --save=calc-zig https://github.com/doccaico/calc-zig/archive/.tar.gz
```
```zig
// build.zig
const calc_zig_dep = b.dependency("calc-zig", .{ .target = target, .optimize = optimize });
exe.linkLibrary(calc_zig_dep.artifact("calc"));
// main.zig
const std = @import("std");
const c = @cImport({
@cInclude("calc-c/calc-c.h");
});
pub fn main() void {
std.debug.print("{d}\n", .{c.add(1, 2)});
std.debug.print("{d}\n", .{c.sub(10, 3)});
std.debug.print("{s}\n", .{c.CALC_C_VERSION});
}
```