ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Make LMTX load a custom library
@ 2021-03-01 10:03 Lukas/ConTeXt
  2021-03-01 17:13 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Lukas/ConTeXt @ 2021-03-01 10:03 UTC (permalink / raw)
  To: ntg-context

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
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Make LMTX load a custom library
  2021-03-01 10:03 Make LMTX load a custom library Lukas/ConTeXt
@ 2021-03-01 17:13 ` Hans Hagen
       [not found]   ` <3nW.6Ao7Z.3OJTX1diB6O.1WFIQ6@seznam.cz>
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2021-03-01 17:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Lukas/ConTeXt

On 3/1/2021 11:03 AM, Lukas/ConTeXt wrote:
> 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?

normally in something:

E:\tex-context\tex\texmf-win64\bin\lib\luametatex\wincon\wincon.dll

(mtxrun --generate)

maybe

\enabletrackers[resolvers.libraries]

gives you a clue

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Make LMTX load a custom library
       [not found]   ` <3nW.6Ao7Z.3OJTX1diB6O.1WFIQ6@seznam.cz>
@ 2021-03-01 18:20     ` Hans Hagen
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2021-03-01 18:20 UTC (permalink / raw)
  To: Lukas/ConTeXt, mailing list for ConTeXt users

On 3/1/2021 6:38 PM, Lukas/ConTeXt wrote:
> Hello Hans,
> is it possible to keep wincon.dll outside the LMTX installation tree?
> I'd rather avoid anything in E:\tex-context\tex\* (or the installation 
> dir in my comp).
> I keep Lua DLLs (and other extensions) independently as they need to be 
> accessible for many programs.
> Or - is it possible to tell "mtxrun --generate" somehow to scan a 
> specific directory, too (be it d:\Lukas\Lua\54\* in my case)?
The installer doesn't wipe the bin tree. In windows you can have the dll 
in some system path too and there's also

   package.extralibpath("d:/Lukas/Lua/54")

or you can add stuff to the configuration file. I admit that I haven't 
tested that in a while (I only occasionally use(d) the mysql library but 
either with ffi (mkiv) or with the built in one (lmtx), not some 
external lua specific wrapper).

The mentioned tracker shows you all the places where libs are searched.

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-01 18:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01 10:03 Make LMTX load a custom library Lukas/ConTeXt
2021-03-01 17:13 ` Hans Hagen
     [not found]   ` <3nW.6Ao7Z.3OJTX1diB6O.1WFIQ6@seznam.cz>
2021-03-01 18:20     ` Hans Hagen

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).