lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

>the portability issues have to do with the calling convention I

Yes, plus the fact that you need some assembly to make all this work I guess.

>How is it possible to
>make the lua interpreter call the wrapper function instead of the
>actual C function supplying it with C function pointer and args(so
>that the wrapper can do the actual calling)?

For each C function you want to export to Lua, register a closure of the
universal wrapper with the actual C function (plus whatever information you
need to get arguments from the C stack and push them onto the Lua stack;
you'll need to know the number and types of arguments for this).