アヲタロウ 🥑


I started a smal project called bunfigen.

It is an bun ffi generator. But what is that?

Bun, is an JavaScript runtime and you could say it's my tool of choice when it comes to script something.

But JS runtimes for 'everything' so far had always an major flaw: The way of using foreign code, aka libs for this and that, was somewhat limited and anoying to use. In fact I only remember a few times when I used 'compiled libs' in NodeJS and it always had been PAIN.

But I like pain, you know?

So I always had a look around about the way ffi works for Node, Deno or Bun...

And then bun did something that amazed me: They added the TinyC compiler staight into the thing.
This allows you to compile smal C-Code at runntime and just use it! No more 'is this the right platform?' or 'this is not working :(' - You just compile it while allready driving on the Road where you going to use it.

Needless to say: This screamed for more fun. So I wrote bunfigen - and small generator that tries to do the 'anoying' ffi stuff for you so that you just can use it without digging too deep into the (not perfectly) documentation.

#include "raylib.h"
#pragma use "raylib"

void InitWindow(int width, int height, char* title);
bool WindowShouldClose();
void CloseWindow();
void SetTargetFPS(int fps);

void BeginDrawing();
void EndDrawing();
void ClearBackground(Color color = RAYWHITE);

void DrawText(char *text, int posX, int posY, int fontSize = 20, Color color = BLACK);

I can just feed this 'almost' C-Ish definition into bunfigen and focus on my real project since the bindings will just compile at runtime. Nice.

Interested peps can read more about that on it's codeberg README file.