[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: luajit ffi - calling a luajit function via a C function pointer?
- From: Geoff Leyland <geoff_leyland@...>
- Date: Fri, 11 Feb 2011 07:51:38 +1300
On 11/02/2011, at 7:12 AM, Mike Pall wrote:
> So what magical things does that C++ code do and why can this not
> be written in Lua? No, you don't have to answer that, better work
> on fixing it.
One use case is calling Lua functions from numerical libraries. For example, ipopt  is a C++/FORTRAN library that finds a local minimum of a nonlinear optimisation problem. ipopt calls a set of user-defined functions to evaluate objective functions, constraints and various derivatives. Rima has an interface to ipopt now, so in that case ipopt is calling Lua functions repeatedly.
You're right, someone *could* rewrite ipopt in Lua, but, for me at least, that seems about as hard as rewriting LuaJIT would be, and anyway, maybe next week I'll want to use couenne . I don't expect any magic from LuaJIT to help in this situation, but I think it does occur legitimately.