[mercury-users] What's the header file for using Mercury types in C files?

Julien Fischer juliensf at cs.mu.OZ.AU
Sun Apr 2 14:26:29 AEST 2006


On Sat, 1 Apr 2006 doug.auclair at logicaltypes.com wrote:

> So, I attempted mmc to compile my training_cars.m: 1000 facts, arity 3, one of the
> output vars is an alist of 25 pairs.  On sparc.sun.solaris2.8 it dies with a detstack#0
> overflow.

Does increasing the detsack size help?

>  On powerpc.apple.darwin8.5, it does not finish after 45 minutes (I have a
> 15kb app sample if interested), so I terminated that attempt.
>
> training_cars.m is potentially a very small example of what I need to sample.

Note that even with his fixes Zoltan couldn't compile the full training_cars
example on his laptop, see:

<http://www.cs.mu.oz.au/research/mercury/mailing-lists/mercury-reviews/mercury-reviews.200603/0127.html>

> I saw Zoltan's sample of an alternative approach; I'm wondering about another
> way: modelling the fact table in C.  Herein lies my question:
>
> What file do I need to include to compile my C file that uses SUCCESS_INDICATOR
> and other MR_ types and macros using gcc?

mercury_init.h, see the comments at the head of that file.  See also,
samples/c_interface/simple_c_calls_mercury/main.c.

>  I am compiling the C object files separately (not embedding them into the
>  Mercury sources).  I tried including
>  $MERCURY/lib/mercury/inc/mercury_types.h but there were some errors and so
>  many warnings that I'm wondering if there's a standard, simple, header
>  representing Mercury types and macros for C use.

If there is a problem with embedding the C code directly in foreign_code
pragmas (which would be my preferred solution in most circumstances), how
about #including the C sources inside a foreign_code pragma.  That would mean
you wouldn't need to worry about what header files to include.

Julien.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list