lua-users home
lua-l archive

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


Mike,

This is simply awesome!

And thanks everyone, I've learned a lot from the discussion!

I'm newbie lua user (used it long time ago, for external testing of
"C" library I had to support), and a friend of mine told me that my
code is not much lua looking :) I'll have to learn for example more
about metatables, (for example I don't know much about metatables).

I have some experience dealing with Common Lisp's CFFI, and LispWorks
FLI, and I find Mike's system very close to what I've used, if not
easier (declaring using the "C" way, rather than s-expressions would
be easier for randomly picked programmer).

Cheers,
Dimiter "malkia" Stanev.

On Wed, Jan 26, 2011 at 11:20 AM, Mike Pall <mikelu-1101@mike.de> wrote:
> Henk Boom wrote:
>> That's good to know. Is there a way to bind a function by address
>> instead of by name so that *GetProcAddress() can be used?
>
> Declaring it as a function pointer ought to work:
>
> ffi.cdef[[
> void (*glExtGetShadersQCOM)(unsigned *shaders, int maxShaders, int *numShaders);
> ]]
>
> local lib = ffi.load(...)
> lib.glExtGetShadersQCOM(...)
>
> Yes, the FFI automatically dereferences function pointers for
> calls.
>
> --Mike
>
>



-- 
Dimiter "malkia" Stanev,
ICQ: 21875894
malkia@mac.com
malkia@gmail.com