How exactly do you mean to combine "ffi" and
"--shell-escape" to work with latest ConTeXt/LuaTeX?

In usual luatex, ffi needs --shell-escape, since ffi
is dangerous from the point of view of the security.
As you know, ConTeXt allows --shell-escape, so the
following works with context test.tex.

%
% context test.tex
%
\starttext
\placeformula
\startformula
j_1(2.387) =
\startluacode
 local ffi = require("ffi")
 ffi.cdef[[
   double _j1(double x);
 ]]
 local mscrt = ffi.load("msvcrt")
 tex.print(mscrt._j1(2.387))
\stopluacode
\stopformula
\stoptext

In the above example, a function _j1(x) in msvcrt.dll
is evaluated. The msvcrt.dll must be loaded as above,
because standard C library is linked statically.
The following DLLs can be used without loading,
because luatex knows them:

SHLWAPI.dll
WSOCK32.dll
USER32.dll
ADVAPI32.dll
SHELL32.dll
KERNEL32.dll
WS2_32.dll
GDI32.dll

Note that you may not be able to use "DLL Lua Modules"
in this way.  I don't know details. Try various cases.

Best,
Akira

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to