Data update

This commit is contained in:
Ingy döt Net 2025-08-11 18:05:26 -07:00
parent 4d5544505c
commit 4924dd0264
3073 changed files with 55820 additions and 4408 deletions

View file

@ -0,0 +1,18 @@
/* mylib.c */
// gcc -c -fpic mylib.c
// gcc -shared -o mylib.so mylib.o
#include <string.h>
#include <stdlib.h>
static void *strptr = NULL;
extern char *my_strdup(const char *src) {
strptr = (void *)strdup(src);
return (char *)strptr;
}
extern void my_free() {
free(strptr);
}

View file

@ -0,0 +1,10 @@
local ffi = require "pluto:ffi"
local lib = ffi.open("./mylib.so")
lib:cdef[[
char *my_strdup(const char *src);
void my_free();
]]
local s = "Hello World!"
print(lib.my_strdup(s))
lib.my_free()
lib = nil