mark gossage wrote:
> Note: if you need to get lua to manage the memory for you, the last parameter of the SWIG_NewPointerObj() fn should be 1, and you will need to write a suitable function to free the memory.
> That should get you started. Let me know if this is the kind of problem you want to solve. Otherwise please provide a code sample.
> To the SWIG developers: does anyone have a good solution for this pointer-pointer argument?
> Mark Gossage
thank you for showing me the quick solution to my problem. Possibly I
should provide the code that I'm working on.
The functions that I want to bind are from XLib library (X11 protocol).
There is a function, for example:
XQueryTree(Display *display, Window w, Window *root_return, Win-
dow *parent_return, Window **children_return, unsigned int
At the time I have to call this function, I already got first and second
arguments at the hand: Display* (lua userdata, initialized before),
and Window w (also initialized before). What I need, is to pass the
pointers (args 3,4,5,6 (counting beginned with 1)) which will be filled
inside the XQueryTree() function. Usually, there is a way to create a
userdata from Lua with new_Window() -- this will get a pointer, but
there is no generic way to get a pointer to pointer to a primitive or a
structure without defining my own typemaping functions. It seems also
that I need to (?) create a separate typemap function for every type I
am working with, because of the bug #1359431
Anyway, thanks for the help! ;)