21 lines
612 B
JavaScript
21 lines
612 B
JavaScript
import { dlopen, FFIType, suffix } from "bun:ffi";
|
|
|
|
const path = `./libtesticolo.so`;
|
|
|
|
const { symbols } = dlopen(path, {
|
|
testicolo: {
|
|
args: [FFIType.cstring, FFIType.cstring],
|
|
returns: FFIType.void,
|
|
},
|
|
});
|
|
|
|
const input = "qwertyuiopasdfghjkllzxcvbnm123456789mnbvcxzlkjhgfdsapoiuytrewq1234567890";
|
|
const output = new ArrayBuffer(input.length + 1);
|
|
const outputView = new Uint8Array(output);
|
|
|
|
// Call the function with the input string
|
|
symbols.testicolo(input, outputView);
|
|
|
|
// Convert the output buffer to a string and log it
|
|
const result = new TextDecoder().decode(outputView);
|
|
console.log(result);
|