[m-users.] Compiling Mercury Compiler with C++ on Linux using different Compiler

Julien Fischer jfischer at opturion.com
Fri Jun 7 13:21:07 AEST 2013


On Thu, 6 Jun 2013, John Adams wrote:

> My project would requires Mercury generated C code to be embedded in a
> C++ project.

That's fairly straightforward.  The header files in the Mercury runtime
and those generated by the Mercury compiler are all compatible with C++,
so you can just export Mercury procedures, types and enumerations to C
as normal and then use them from C++.

The recommended way of using Mercury with C or C++ applications is to
use what's called a standalone-interface.
for details.)

> Hence I am interested in compiling Mercury under a C++ compiler (call
> is cxx) in Linux. I am only interested in High Level C grade.

You cannot (currently) compile Mercury generated code with a C++
compiler.  (If you just want to call Mercury code from C++ then you do
not need to.)

> How do I only select High Level C grade with a different C++ compiler?
> Also, I would like Mercury native type to be mapped to C++'s "long
> long" instead of int. Can I do that?

No, Mercury's int tpye is defined (and required) to be the same size as
the word size of the machine.  It will (and must) correspond to
whichever signed C/C++ integer type fulfills that requirement.


More information about the users mailing list