garnet/rust/garnet_rs.h
George Thomas 9ca4f615d8 Use simpler tagged union translation
Avoids the worst part of the header hack, and makes Haskell wrapper simpler.
2026-02-19 17:22:15 +00:00

40 lines
615 B
C

#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct T {
bool a;
uint8_t b;
} T;
typedef enum Shape_Tag {
Circle,
Rectangle,
} Shape_Tag;
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);
__attribute__((const)) int64_t add(int64_t a, int64_t b);