[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Binary Modules for Lua [was Re: External modules]
- From: Björn De Meyer <bjorn.demeyer@...>
- Date: Fri, 22 Nov 2002 19:58:42 +0100
Gunnar Zötl wrote:
> Björn de Meyer wrote:
> BDM> Hmmmm... not bad... I'm currently trying to get a similar though
> BDM> slightly different idea to work. My idea was to be able to say in
> BDM> Lua:
> BDM> libc = loadlib("c");
> BDM> malloc = libc:declare("malloc","pointer","int")
> BDM> ...
> Something like that can be achieved with the binding of lua to the ffi
> library, I think. The only problem with that is, that the ffi lib is
> quite dated, and I am not sure about how well it works on windows.
> However, you might want to look at it:
I investigated libffi, and it would be what I needed, but it dooes not
support windows. Furthermore I don't have the means nor incentive to
a windows port of libffi... I've looked into more "ANSI standard"
ways to do what I want, but these would involve humongous switch
statements with different thousands of function calls... like this:
int call_function( int (func)(),long argtype, void *args)
case VOID: return f();
case PVOID: return f((void *)(args));
case CHAR: return f((char)(*args));
case PCHAR: return f((char *)(args));
/*... etc,etc... with maybe 1000 possible different function signatures,
Unless someone could give me an idea of how to do it in ANSI C, OR
someone could help me port libffi, I think I'll have to let my idea
go for now. More interesting now seems to be the port of tolua
to lua 5, and of course that incestuous lua lexer/parser in lua...
"No one knows true heroes, for they speak not of their greatness." --
Björn De Meyer