[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: LuaJIT2 FFI Help
- From: "Gerry Weaver" <gerryw@...>
- Date: Sun, 17 Apr 2011 18:45:10 -0500
Hello All,
I've been playing around with the new ffi stuff in LuaJIT2 (very cool). This is going pretty well for the most part, but I'm having some trouble with a couple of cases. I'm fairly new to Lua, so forgive my ignorance when it comes to type conversion between Lua and C. I'm having some trouble with the following items:
typedef void my_ctx_t;
bool my_init(my_ctx_t **ctx);
bool my_get_string(my_ctx_t *ctx, char **str);
void my_term(my_ctx_t *ctx);
1. I can't figure out exactly how to handle "my_ctx_t". I have been fiddling around with this and I guess I'm missing something basic in understanding how to go from the "my_ctx_t **" in the init function to the "my_ctx_t *" in the other functions.
2. I am also having the same issue with the "char **" in the "my_get_string" function and how to turn that into a Lua string.
I guess I'm basically having issues figuring out how to handle function args that set a value, or more specifically, the <type>** case. I would really appreciate a nudge in the right direction on this.
Thanks for your time,
-G