[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LuaJIT FFI only bindings for glfw, OpenCL, OpenGL
- From: Peter Cawley <lua@...>
- Date: Wed, 26 Jan 2011 16:42:19 +0000
On Wed, Jan 26, 2011 at 4:25 PM, David Given <dg@cowlark.com> wrote:
> (I was also rather hoping you'd have a
> cunning way of detecting fastcall. I hate x86.)
Though not applicable to the FFI, my approach to detecting
cdecl/stdcall/fastcall is to find a function in the API which takes 1
or 2 parameters, and then call it via a special assembly stub which
puts one set of values in the fastcall registers, and a different set
of values on the stack, then check for a difference in stack pointer
to detect stdcall, and externally observe the behavioural difference
between the fastcall values and the cdecl/stdcall values to detect
fastcall. For example, given a Lua API with unknown calling
convention, call lua_settop in way that sets the top to 1 if it was
fastcall, or 0 if it was stdcall/cdecl, then call lua_gettop to detect
whether it was fastcall.
- References:
- LuaJIT FFI only bindings for glfw, OpenCL, OpenGL, malkia
- Re: LuaJIT FFI only bindings for glfw, OpenCL, OpenGL, CrazyButcher
- Re: LuaJIT FFI only bindings for glfw, OpenCL, OpenGL, Henk Boom
- Re: LuaJIT FFI only bindings for glfw, OpenCL, OpenGL, David Given
- Re: LuaJIT FFI only bindings for glfw, OpenCL, OpenGL, Mike Pall
- Re: LuaJIT FFI only bindings for glfw, OpenCL, OpenGL, David Given
- Re: LuaJIT FFI only bindings for glfw, OpenCL, OpenGL, Mike Pall
- Re: LuaJIT FFI only bindings for glfw, OpenCL, OpenGL, David Given