buzz icon indicating copy to clipboard operation
buzz copied to clipboard

`cdef`

Open giann opened this issue 2 years ago • 0 comments

cdef("/path/to/foreign", `
    typedef struct Person
    {
        unsigned int age,
        const char *title name,

        fn hello(self: Person) void;
    };

    void hello(*Person self);

    unsigned int mul(unsigned int a, unsigned int b);
`);

cdef("/path/to/foreign", "foreign.h")

| No different from an buzz object instanciation in syntax
Person person = Person{
    age = 12,
    name = "Joe",
};

person.hello();

print("{person}"); | -> struct Person: 0xef231b

mul(123, 243);

Try to get an AST using arocc.

giann avatar Aug 30 '23 11:08 giann