From e6e7f4c8ad9bffd536182923c8e556ca028cec04 Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Sun, 16 Nov 2025 13:01:59 -0600 Subject: [wip] plugin stuff --- main.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'main.c') diff --git a/main.c b/main.c index 111424c..273d797 100644 --- a/main.c +++ b/main.c @@ -2,17 +2,18 @@ #include #include #include +#include #include "pipeline.h" #define UNUSED(_v) ((void)(_v)) -PIPELINE_STAGE int identity_stage_handle(const ptx_pipeline_ctx_t *ctx, const void *data, size_t sz) +PIPELINE_STAGE static int identity_stage_handle(const ptx_pipeline_ctx_t *ctx, const void *data, size_t sz) { return ptx_pipeline_ctx_next(ctx, data, sz); } -PIPELINE_INIT int debug_stage_init(const char *name, void **ppuser, va_list init_args) +PIPELINE_INIT static int debug_stage_init(const char *name, void **ppuser, va_list init_args) { static const char *const messages[] = { "no continue :(", "continue :)" }; @@ -26,12 +27,12 @@ PIPELINE_INIT int debug_stage_init(const char *name, void **ppuser, va_list init return 0; } -PIPELINE_CLEANUP void debug_stage_cleanup(const char *name, void *puser) +PIPELINE_CLEANUP static void debug_stage_cleanup(const char *name, void *puser) { printf("Debug stage %s (cleanup): %p\n", name, puser); } -PIPELINE_STAGE int debug_stage_handle(const ptx_pipeline_ctx_t *ctx, const void *data, size_t sz) +PIPELINE_STAGE static int debug_stage_handle(const ptx_pipeline_ctx_t *ctx, const void *data, size_t sz) { bool cont = !!(uintptr_t)(*ptx_pipeline_ctx_get_user(ctx)); printf("Debug stage %s:\n Data: %p\n Size: %zu\n", ptx_pipeline_ctx_get_name(ctx), data, sz); @@ -121,5 +122,19 @@ int main(void) { ptx_pipeline_free(pl); + void *mod; + if (!(mod = dlopen("plugins/libm_skibidi.so", RTLD_LAZY | RTLD_LOCAL))) { + printf("dlopen: %s\n", dlerror()); + return 1; + } + + int (*f)(void) = dlsym(mod, "do_something"); + if (!f) { + printf("dlsym: %s\n", dlerror()); + return 1; + } + + printf("f: %d\n", f()); + return 0; } -- cgit v1.2.3-70-g09d2