lua-users home
lua-l archive

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


tolua handles reference parameters nicely (they are returned as additional
return values)

have a look at http://www.tecgraf.puc-rio.br/~celes/tolua/#functions

Peter

-----Original Message-----
From: owner-lua-l@tecgraf.puc-rio.br
[mailto:owner-lua-l@tecgraf.puc-rio.br]On Behalf Of J. Perkins
Sent: Wednesday, August 29, 2001 3:24 PM
To: Multiple recipients of list
Subject: Re: The Lua C API


Jens Wessling wrote:
> The only thing I have to do to export a function to Lua is
> to preface it with LUA_EXPORT.  This is #defined as
> __declspec(__dllexport)
>
> Which, when you are using VC++ means to put the function
> declaration in the export table.
>
> I then parse the binary image of the executable at run time
> and extract all of the functions that are exported, demangle
> their names, and use this information, not only to call the
> C++ function from Lua, but to insure they are called in a
> type-safe way, even for userdata/void* data.  This idea was
> first proposed and written by Scott Bilas.  For a good
> reference, see FuBi at http://members.aa.net/~scottb/gdc/ .


I have looked at that paper, but since I am working on multiple
platforms/compilers I'm not able to use the technique (or rather,
I didn't feel like making it work on other platforms). My macros
aren't really all that intrusive, I'll stick with them.

Did you figure out a solution to passing parameters by reference?
What would you do in the case of, say:

   void getWindowSize(int* width, int* height);

I've worked around this case so far by either rewriting the
function or adding special code to the wrapper, but a generic
transparent solution would be nice.

Jason