aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorLibravatar bigfoot547 <[email protected]>2025-11-16 13:01:59 -0600
committerLibravatar bigfoot547 <[email protected]>2025-11-16 13:07:20 -0600
commite6e7f4c8ad9bffd536182923c8e556ca028cec04 (patch)
tree3b5409c06ab260116a95e919f9b2c5161c8d63e3 /main.c
parentadd removal test and const-qualify data (diff)
[wip] plugin stuff
Diffstat (limited to 'main.c')
-rw-r--r--main.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/main.c b/main.c
index 111424c..273d797 100644
--- a/main.c
+++ b/main.c
@@ -2,17 +2,18 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdarg.h>
+#include <dlfcn.h>
#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;
}