Luigi has shown me a simple and useful application of ffi:
In the case of lua(jit)tex in W32TeX, which are used in context, standard C libraries are linked statically. Thus it is necessary to load a necessary DLL for standard C functions, like the following meaningless example: \starttext $$ j0(1.765)= \startluacode ffi=require("ffi") ffi.cdef[[ double _j0(double x); ]] -- In the case of lua(jit)tex in W32TeX, C libraries are linked -- statically. Thus it is necessary to load a necessary DLL. local msvcrt=ffi.load("msvcrt") tex.print(msvcrt._j0(1.765)) \stopluacode $$ \stoptext It is expected that Windows APIs in the following libs can be used without loading DLL: WSOCK32.dll USER32.dll ADVAPI32.dll SHELL32.dll GDI32.dll KERNEL32.dll WS2_32.dll 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 ___________________________________________________________________________________