From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/109230 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Jairo A. del Rio" Newsgroups: gmane.comp.tex.context Subject: Re: About loading C libraries (again) Date: Wed, 4 Nov 2020 21:42:18 -0500 Message-ID: References: <05f82ec7-17c0-344b-e65a-fe47a0f99182@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============9140609648851542700==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9609"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Thu Nov 05 03:43:21 2020 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaVFB-0002Qi-CF for gctc-ntg-context-518@m.gmane-mx.org; Thu, 05 Nov 2020 03:43:21 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 16C531A9C5C; Thu, 5 Nov 2020 03:42:33 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D3h3Byn6N7bh; Thu, 5 Nov 2020 03:42:32 +0100 (CET) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2F4991A9D99; Thu, 5 Nov 2020 03:42:32 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 41A391A9D86 for ; Thu, 5 Nov 2020 03:42:31 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G9DdTnAWFQev for ; Thu, 5 Nov 2020 03:42:30 +0100 (CET) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.221.50; helo=mail-wr1-f50.google.com; envelope-from=jairoadelrio6@gmail.com; receiver= Original-Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 65E511A9C5C for ; Thu, 5 Nov 2020 03:42:30 +0100 (CET) Original-Received: by mail-wr1-f50.google.com with SMTP id i10so137470wrx.13 for ; Wed, 04 Nov 2020 18:42:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0Xx9IOWEe7vaBkl5+p722iwG5a0xjPZfvkhMhx9Djb8=; b=drCPcVSRThiW2p1LkuhGRAb/eE870YUD1tv0yjr58bwQ+r4Dk0lLEwJiXCYTs6l6Go 9EZVYhWQBv9ZSgfUYV4ZCWTDUdXIuQNiAXaXtbnWBb6zRAAV6lcvJwObZtFnGk3PDnO4 xxwhyVwFRl3fYl/LA4/TlTSEeyrbV0uYCdBkZXyl6RQlIE49caVUa2eLZbfhuA4M6gPh 7ZzYMSNUqAJXGKEJPCfWAiT/Jm6VgMAj+q8Y7QYsz5XkjG4zTPNZiuqISXekAS+8DoJu 0Ldo7x+q1S4nFnKmMkxNVgGlSWD7IE6u1V/MeGUHSf5imxOl5Ktv4iZ+l+5E1f7diCwW GSew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0Xx9IOWEe7vaBkl5+p722iwG5a0xjPZfvkhMhx9Djb8=; b=r8D44ey0+AXDu1WoFx8GaJFTwRd+beh/n97WXVgXA6DS4KeAddbEYWGkwj29afJhak 2QGkXMzay79hDTDrEjpeh0BPo9Ft3ihMwruZGUfmlA6+4oztSoxmWNsPU5/fNKaHMQ4x 3Bw12JZ7FJT7ixJ7XNKh0j5GMjQHGpcK5xe1L84ZK8ABFO3fQgznwY0W0J97wpK147pL o2atWHM/3an6Fj9V+mTGGy8sATWbBzwQ6oogYIc8lKBdhXqIjCcUtRMtQE3Juz14SAgj kgvlxSst+P5NcjB/uFURJGopGKTIDPNdYuNScI/YnMveAbkk+Zn76sGaMv6i0y5+BIOi BUEw== X-Gm-Message-State: AOAM5327wV4VQAw6A3d85aZtI+v3lq4swhvz+s2E+GITt94mJXw4eLD/ oOA/4+XFNODycxsdqufIOwnD6q7olqZOiNU3ONs= X-Google-Smtp-Source: ABdhPJzKtkx61+QsTph0TUUMftGcmDyvipbKBTFUIsUxTHGvvlAF+O4rrdCnX0o+vkWL7yKChdUtmgOlw9n68UfmO/8= X-Received: by 2002:adf:cd82:: with SMTP id q2mr124454wrj.118.1604544149941; Wed, 04 Nov 2020 18:42:29 -0800 (PST) In-Reply-To: <05f82ec7-17c0-344b-e65a-fe47a0f99182@xs4all.nl> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:109230 Archived-At: --===============9140609648851542700== Content-Type: multipart/alternative; boundary="00000000000015704605b3530c55" --00000000000015704605b3530c55 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi again. I grepped the new release and I see permitloadlib is already included in mtxrun. Just out of curiosity, is --permitloadlib called via context or should I use it from mtxrun? context --permitloadlib file.tex still doesn't have any effect. Best wishes, Jairo :) El mi=C3=A9., 4 de nov. de 2020 a la(s) 06:44, Hans Hagen (j.hagen@xs4all.n= l) escribi=C3=B3: > 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 =3D require"hellolib" -- hellolib.so > > > > context(hello.helloworld()) > > > > \stopluacode > > > > \stoptext > > > > %hello.c > > #include > > #include > > > > static int helloworld (lua_State *L) { > > char hello[] =3D "Hello world!"; > > lua_pushstring(L, hello); > > return 1; > > } > > > > static const struct luaL_Reg hellolib [] =3D { > > {"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 > ----------------------------------------------------------------- > --00000000000015704605b3530c55 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi again. I grepped the new release and I see pe= rmitloadlib is already included in mtxrun. Just out of curiosity, is --perm= itloadlib called via context or should I use it from mtxrun?
conte= xt --permitloadlib file.tex still doesn't have any effect.

Best wishes,

Jairo :)

El mi=C3=A9., 4 de nov. de 2020= a la(s) 06:44, Hans Hagen (j.hagen@xs= 4all.nl) escribi=C3=B3:
On 11/4/2020 11:01 AM, Jairo A. del Rio wrote:
> Hi. I've just read in the LuaMetaTeX manual that --permitloadlib a= llows
> 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 =3D require"hellolib" -- hellolib.so
>
> context(hello.helloworld())
>
> \stopluacode
>
> \stoptext
>
> %hello.c
> #include <lua.h>
> #include <lauxlib.h>
>
> static int helloworld (lua_State *L) {
>=C2=A0 =C2=A0 =C2=A0 char hello[] =3D "Hello world!";
>=C2=A0 =C2=A0 =C2=A0 lua_pushstring(L, hello);
>=C2=A0 =C2=A0 =C2=A0 return 1;
> }
>
> static const struct luaL_Reg hellolib [] =3D {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 {"helloworld", helloworld},
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 {NULL, NULL}
>=C2=A0 =C2=A0 =C2=A0 };
>
> int luaopen_hellolib (lua_State *L){
>=C2=A0 =C2=A0 =C2=A0 luaL_newlib(L, hellolib);
>=C2=A0 =C2=A0 =C2=A0 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 "H= ello
> world!").
>
> How is the correct way to load those libraries? Thank you very much an= d
> sorry if my question seems to be weird.
i should add a --permitloadlib option to the context runner then

Hans

-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.pragma-ade.nl | www.= pragma-pod.nl
-----------------------------------------------------------------
--00000000000015704605b3530c55-- --===============9140609648851542700== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============9140609648851542700==--