From 68baff8a1db87e8ade43d5e4fe3cad6a7177e50c Mon Sep 17 00:00:00 2001 From: ColleagueRiley Date: Sun, 5 Jan 2025 19:20:28 -0500 Subject: [PATCH] add nostl --- Makefile | 14 +++++++++++++- RGFW.h | 2 -- examples/nostl/nostl.c | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 examples/nostl/nostl.c diff --git a/Makefile b/Makefile index fd4e7900..022b5a38 100644 --- a/Makefile +++ b/Makefile @@ -177,7 +177,19 @@ else ifeq ($(detected_OS),Darwin) else ifeq ($(CC),emcc) $(CC) $(CFLAGS) $(WARNINGS) -I. $< $(LIBS) $(LINK_GL3) -o $@$(EXT) else - @echo not sure what this platform is + @echo minimal_links is not supported on this platform +endif + + +examples/nostl/nostl: examples/nostl/nostl.c RGFW.h +ifeq ($(detected_OS),Linux) + $(CC) $(CFLAGS) $(LIBS) -nostdlib -I. $< -o $@$(EXT) +else ifeq ($(detected_OS),windows) + $(CC) $(CFLAGS) $(WARNINGS) -nostdlib -I. $< -lgdi32 -o $@$(EXT) +else ifeq ($(detected_OS),Darwin) + $(CC) $(CFLAGS) $(WARNINGS) -nostdlib -I. $< -framework Foundation -framework AppKit -o $@$(EXT) +else ifeq ($(CC),emcc) + @echo nostl is not supported on this platform endif diff --git a/RGFW.h b/RGFW.h index af66ed89..24d6d6b0 100644 --- a/RGFW.h +++ b/RGFW.h @@ -9241,8 +9241,6 @@ void EMSCRIPTEN_KEEPALIVE RGFW_writeFile(const char *path, const char *data, siz RGFW_window* RGFW_createWindow(const char* name, RGFW_rect rect, RGFW_windowArgs args) { RGFW_UNUSED(name); - RGFW_UNUSED(RGFW_initFormatAttribs); - RGFW_window* win = RGFW_window_basic_init(rect, args); #ifndef RGFW_WEBGPU diff --git a/examples/nostl/nostl.c b/examples/nostl/nostl.c new file mode 100644 index 00000000..45b388e4 --- /dev/null +++ b/examples/nostl/nostl.c @@ -0,0 +1,16 @@ +#define RGFW_IMPLEMENTATION +#define RGFW_NO_THREADS + +#include "RGFW.h" + +int main(void) { + RGFW_window* win = RGFW_createWindow("no standard library", RGFW_RECT(0, 0, 200, 100), (u16)(RGFW_center)); + + while (RGFW_window_shouldClose(win) == RGFW_FALSE) { + while (RGFW_window_checkEvent(win)) + + RGFW_window_swapBuffers(win); + } + + RGFW_window_close(win); +} \ No newline at end of file