Coder Social home page Coder Social logo

zffi's Introduction

zFFI

CBindgen FFI test

How to run

Execute:

$> zig build cargo # to build rustlib
$> zig build run # to run

zffi's People

Contributors

dependabot[bot] avatar kassane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

codingonion

zffi's Issues

Enchanced support

Acceptable Criteria

  • Fix comptime support - generic arg_type (requires review)
  • Functors members
  • Nested union and struct support - zig does not support anonymous union | struct, only anonymous literals (requires review)

Enchanced cbindgen - zig

This experiment refers to the development of the zig-bindgen branch.
Below you will find errors during the translation that should be corrected.

Expected

generated/binding.zig: [ FFI Work]

const std = @import("std");

pub const Doggo = extern struct {
    age: i32,
    name: [*:0]const u8,
};

pub extern fn call_name(ptr: ?*Doggo, name: [*:0]const u8) anyopaque;
pub extern fn is_whitespace(byte: u8) bool;
pub extern fn mul(value1: usize, value2: usize) usize;
pub extern fn add(value1: usize, value2: usize) usize;

CBindgen

Generated:

const std = @import("std");

pub const Doggo = extern struct {
  age: i32,
   _name: ?fn, // type error
};

// missing pub keyword to public functions
extern fn call_name( _ptr: ?fn, const  constname: ?fn) anyopaque; // flags type error
extern fn is_whitespace(byte: u8) bool;
extern fn mul(value1: usize, value2: usize) usize;
extern fn add(value1: usize, value2: usize) usize;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.