[NTG-context] Make LMTX load a custom library

Lukas/ConTeXt lpr.context at email.cz
Mon Mar 1 11:03:04 CET 2021


Hello,

suppose having a custom DLL (actualy a Lua module) in:

  d:\Lukas\Lua\54\WinCon.dll

How exactly should I alter the path specification so LMTX be able to load WinCon.dll?

My trials - without success so far - are:

1. Alter LUA_CPATH before running Ctx, so something like:

---- (command line)
set LUA_CPATH=d:\Lukas\Lua\54\?.dll;%LUA_CPATH%
context.exe test.tex ...
----

2. Alter LUAINPUTS before running Ctx, so something like:

---- (command line)
set LUAINPUTS=%LUAINPUTS%;d:\Lukas\Lua\54\?.dll;%LUA_CPATH%
context.exe test.tex ...
----

3. Changing the path at runtime, so something like:

---- test.tex
\startluacode
  package.cpath = package.cpath .. ";d:/Lukas/Lua/54/?.dll"
  require "MyLib"
\stopluacode
----

But I'm still getting errors like:

"
...
token call, execute: ...TX/tex/texmf-context/tex/context/base/mkiv/l-sandbox.lua:180: module 'WinCon' not found:
        no field package.preload['WinCon']
        no file 'd:\Lukas\Lua\WinCon.lua'
        no file 'd:\Lukas\Common\Statics\WinCon.lua'
        no file 'd:\Lukas\Lua\3rdParty\WinCon.lua'
        no file 'd:\Lukas\Lua\3rdParty\stdlib\modules\WinCon.lua'
        no file 'd:\Lukas\Lua\3rdParty\LuaXML\WinCon.lua'
        no file 'C:\Program Files (x86)\Lua\5.1\lua\WinCon.luac'
        no file 'd:\Lukas\Lua\Geom'
...
"

Surprisingly, loader tries to locate a *.lua* only, whilst here I nedd to load a .dll;
and in genereal case, .lua, .luac and .dll may be required.

So - how to specify the path correctly, be it on the command line or within a .tex (LMTX run-time)?

Best regards,

Lukas


More information about the ntg-context mailing list