lua-users home
lua-l archive

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


On Wed, Jun 13, 2012 at 7:16 PM, Geoff Leyland
<geoff_leyland@fastmail.fm> wrote:
> Have you considered allocating your FFI arrays to be one longer than they need to be, and then remembering to offset the pointer to the array by one when you pass it to external C functions.  Not exactly pretty, I know, but perhaps less worse than some alternatives.
>
> (Also, LuaJIT has its own mailing list now: http://luajit.org/list.html)

Ah, thanks I didn't know there was a LuaJIT list now.  I will have to
post there in the future.

I have tried the offset by one method but again run into issues with
the confusing nature of it.  If an end user has to make a native call
(eg. OpenGL) they have to remember to offset the data which is
unexpected.  A solution is to wrap all external API calls, but again:
performance hit when making lots of calls.  That's really the main
issue with all of this, it's just (inconsistent and confusing) or
(slow[er]).

CR