[m-users.] Where is MR_Cont defined?

Mark Brown mark at mercurylang.org
Tue Mar 26 06:29:30 AEDT 2019


On Tue, Mar 26, 2019 at 3:38 AM Cole Ingraham <coledingraham at gmail.com> wrote:
>
> Hi list,
> I'm playing around with calling Mercury from Haskell via FFI with the generated C code. So far I have things working fine for a trivial example. To make this work I created a Haskell project that includes all of the Mercury runtime source.
>
> However when I attempt to use anything from the library, the solutions module for example, I am getting complaints about MR_Cont being undefined. I've been using grep to look through every file in the distribution directory and I can't for the life of me find any header where this is defined (I see plenty of source files where it is used though). Would anyone be able to point me to the appropriate file for this? Much appreciated!

Hi Cole,

It's in runtime/mercury_hlc_types.h, but this is part of Mercury's
internal interface and trying to use these headers would be doing
things the hard way. Instead you can have Mercury generate a
standalone interface for you. There's a well-commented example of
calling Mercury code from another application using this method in the
samples/c_interface/standalone_c directory, which should help to look
at. This is a much easier (and more robust) way of doing things.

See the "Stand-alone Interfaces" chapter of the user's guide, and the
"Foreign language interface" chapter of the reference manual.

Mark


More information about the users mailing list