ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Akira Kakuto" <kakuto@fuk.kindai.ac.jp>
To: <ntg-context@ntg.nl>
Subject: Problem loading a DLL with the latest Ctx beta
Date: Thu, 6 Apr 2017 19:47:56 +0900	[thread overview]
Message-ID: <E273041D96DD40FC83A735AE0362E011@CJ3001517A> (raw)

> 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	other threads:[~2017-04-06 10:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 10:47 Akira Kakuto [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-04-08 22:23 Akira Kakuto
2017-04-11  7:04 ` Procházka Lukáš Ing.
2017-04-18 13:52 ` Procházka Lukáš Ing.
2017-04-05 22:05 Akira Kakuto
2017-04-06  9:03 ` Procházka Lukáš Ing.
2017-04-06 11:54   ` Hans Hagen
2017-04-05 12:29 Procházka Lukáš Ing.
2017-04-05 13:06 ` Hans Hagen
2017-04-05 14:12   ` Procházka Lukáš Ing.
2017-04-05 15:02     ` Hans Hagen
2017-04-05 15:49       ` Procházka Lukáš Ing.
2017-04-05 19:42         ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E273041D96DD40FC83A735AE0362E011@CJ3001517A \
    --to=kakuto@fuk.kindai.ac.jp \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).