[mercury-users] Making a Mercury shared library

Guillaume Yziquel guillaume.yziquel at citycable.ch
Fri Jun 3 10:13:10 AEST 2011


Le Thursday 02 Jun 2011 à 23:47:01 (+0200), Guillaume Yziquel a écrit :
> Hi.
> 
> I wish to make a shared library out of mercury code that I would call
> from an OCaml or C program. I haven't found information about how to use
> mmc to do that. Could someone quickly explain how to do that or pinpoint
> some documentation about that?
> 
> Best regards,

OK. Found out how to build a shared library and link it with my OCaml
code. However, I have some trouble with what seems to initialisation of
mercury engine:

yziquel at seldon:~/sandbox$ make 
mmc --pic -c hello.m
gcc -I /usr/local/mercury-11.01/lib/mercury/inc -I /usr/local/mercury-11.01/lib/mercury/conf -fPIC -c hello_stubs.c
ml --make-shared-lib -o libhello.so hello.pic_o hello_stubs.o
ocamlc -o fibo.byte -dllpath . -dllib libhello.so fibo.ml
yziquel at seldon:~/sandbox$ ./fibo.byte 2
ocamlrun: mercury_engine.c:512: call_engine_inner: Assertion `(MR_engine_base.MR_eng_this_context)' failed.
Abandon
yziquel at seldon:~/sandbox$ 

What should I do to properly initialise the engine from foreign code?

-- 
     Guillaume Yziquel

--------------------------------------------------------------------------
mercury-users mailing list
Post messages to:       mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions:          mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the users mailing list