No dia 27/12/2017, às 09:31, Hans Hagen <pragma@wxs.nl> escreveu:

On 12/26/2017 9:19 PM, Jorge Manuel wrote:
Dear Sirs
Recently I moved to High Sierra with lua version 5.3.
I make a dynamic library from GSL and Swig the I call meurandist.so
I do:
swig -lua meurandist.i
gcc -I/usr/include/lua -c meurandist_wrap.c -o meurandist_wrap.o
gcc -c meurandist.c -o meurandist.o
gcc -fpic -bundle -undefined dynamic_lookup -llua -lgsl -lgslcblas -lm -Wall -I/usr/local/include -L/usr/local/lib meurandist_wrap.o meurandist.o -o meurandist.so
In my old machine all I need to do for call this library are
"sudo cp randist.so /usr/local/lib/lua/5.2”
And then
\startluacode
require "meurandist"
ARRAY_SIZE=100
arr=meurandist.new_int(ARRAY_SIZE)
meurandist.rpoisson(arr,ARRAY_SIZE,4)
for i=0,ARRAY_SIZE-1 do
        context(" "..meurandist.int_getitem(arr,i)..",")
  end
\stopluacode
Works nicely.
But now I don’t have lua 5.2 installed. I have copied my dynamic library in the lua5.3 tree and that works fine if I call them from the console, but not works if all call inside a context document.
Did I need to install lua 5.2? Is it mandatary? Is there a another way to call c libraries?
Thanks a lot and have a luck year.
lua 5.3 has different 'number' internals so i think that 5.3 libs will not work with 5.2

anyway, you can probably best install lua 5.2 (otherwise, you also might need to adapt existing lua code to 5.3)

Hans




My library works fine with lua 5.3, but I don’t know to fix that inside ConTeXT tree. Install lua 5.2 is the best and easy way.





Thanks a lot

Jorge



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