-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decode makes my programme crash #138
Comments
In the This works for me: // gcc -shared -o 138.so -O2 -Wall 138.c
typedef struct Request {
int dummy;
} Request;
typedef struct TupleString2 {
char *first;
char *last;
} TupleString2;
static TupleString2 tuple = {
.first = "hello",
.last = "world"
};
TupleString2 *get_headers(Request *req)
{
return &tuple;
} const koffi = require("koffi");
const lib = koffi.load("./138.so");
const StringTuple2 = koffi.struct({
first: "char *",
last: "char *"
})
const rust_get_headers = lib.func("get_headers", koffi.pointer(StringTuple2), [koffi.pointer(koffi.opaque("Request"))]);
let ret = rust_get_headers(null);
let tuple = koffi.decode(ret, StringTuple2);
console.log(tuple); |
I tried to do this with one to but I have the same problem |
I'm mainly looking to get a vector from rust |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I use koffi in a project and I have a function this function (it's in rust) :
in c my function is equivalent to
but want I try to do :
My programme crash. Did I do something wrong with the decode?
The text was updated successfully, but these errors were encountered: