Re: ffi and inline functions

  • From: Fjölnir Ásgeirsson <fjolnir@xxxxxxxxxxxxx>
  • To: luajit@xxxxxxxxxxxxx
  • Date: Mon, 14 May 2012 14:19:14 +0900

Oh I'm sorry, I misunderstood. Yes that shouldn't be a problem
Something like this should do it:
local dxLib = ffi.load(<path>)
local dx = {}
setmetatable(dx, { __index = dxLib })

dx.inlinedFunctionImplementation = function()
-- Do stuff

– Fjölnir

On May 14, 2012, at 2:15 PM, Kaj Eijlers wrote:

> On Sun, May 13, 2012 at 10:10 PM, Fjölnir Ásgeirsson <fjolnir@xxxxxxxxxxxxx> 
> wrote:
> Not if the function is inlined.
> I don't mean to call the original function - I want to rewrite the body in 
> lua, not sure I made that clear.
> I wondered if I can, instead of returning the ffi.load, return an object with 
> a metatable that implements lua functions and for all else falls through with 
> an __index function. But so far I am not successful. Seems I am trying to do 
> something that is beyond my somewhat limited lua skills. Not a good place to 
> be if you want to mess with ffi.

Other related posts: