garnet/rust/garnet_rs.h
George Thomas 5907a064a7 Use fixed-width integers
Even though `Int` and `isize` should be the same in practice, we can't cleanly convert, as the type information isn't quite there. And anyway, strictly speaking per the report, `Int` is only guaranteed to hold 30 bits.

Note that this is essentially unchanged even if we specify `usize_is_size_t = true` for `cbindgen`.
2026-02-19 17:19:28 +00:00

39 lines
597 B
C

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct T {
bool a;
uint8_t b;
} T;
typedef uint8_t Shape_Tag;
#define Circle 0
#define Rectangle 1
typedef struct Circle_Body {
double radius;
} Circle_Body;
typedef struct Rectangle_Body {
double width;
double height;
} Rectangle_Body;
typedef struct Shape {
Shape_Tag tag;
union {
Circle_Body circle;
Rectangle_Body rectangle;
} body;
} Shape;
void hello(const char *c);
void hello_struct(struct T t);
void hello_shape(struct Shape s);
int64_t add(int64_t a, int64_t b);