ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: "Jairo A. del Rio" <jairoadelrio6@gmail.com>,
	mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: About loading C libraries (again)
Date: Wed, 4 Nov 2020 12:44:18 +0100	[thread overview]
Message-ID: <05f82ec7-17c0-344b-e65a-fe47a0f99182@xs4all.nl> (raw)
In-Reply-To: <CAKyqqab6HGyqRJTqgb5tsc6ANDfJ6PbkKq_VhOCW63Zj_saUSA@mail.gmail.com>

On 11/4/2020 11:01 AM, Jairo A. del Rio wrote:
> Hi. I've just read in the LuaMetaTeX manual that --permitloadlib allows 
> loading compiled (.so/.dll) libraries. However, when I try it using 
> ConTeXt I have an error message (example below):
> 
> %hello.tex
> 
> \starttext
> 
> \startluacode
> 
> local hello = require"hellolib" -- hellolib.so
> 
> context(hello.helloworld())
> 
> \stopluacode
> 
> \stoptext
> 
> %hello.c
> #include <lua.h>
> #include <lauxlib.h>
> 
> static int helloworld (lua_State *L) {
>      char hello[] = "Hello world!";
>      lua_pushstring(L, hello);
>      return 1;
> }
> 
> static const struct luaL_Reg hellolib [] = {
>        {"helloworld", helloworld},
>        {NULL, NULL}
>      };
> 
> int luaopen_hellolib (lua_State *L){
>      luaL_newlib(L, hellolib);
>      return 1;
> }
> 
> 
> error (lua loadlib): you can only load external libraries when 
> --permitloadlib is given
> 
> 
> On the other hand, manually calling LuaMetaTeX with the ConTeXt format 
> and --permitloadlib gives the expected result (in this case, a "Hello 
> world!").
> 
> How is the correct way to load those libraries? Thank you very much and 
> sorry if my question seems to be weird.
i should add a --permitloadlib option to the context runner then

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
___________________________________________________________________________________

  reply	other threads:[~2020-11-04 11:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 10:01 Jairo A. del Rio
2020-11-04 11:44 ` Hans Hagen [this message]
2020-11-05  2:42   ` Jairo A. del Rio
2020-11-05  9:08     ` 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=05f82ec7-17c0-344b-e65a-fe47a0f99182@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=jairoadelrio6@gmail.com \
    --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).