[mercury-users] Problem with linking bigger project (Mercury and C++)

Fergus Henderson fjh at cs.mu.OZ.AU
Mon Jan 7 12:24:49 AEDT 2002


On 07-Jan-2002, Roy Ward <rward at infoscience.otago.ac.nz> wrote:
> OK, it's good to know what the dummy is used for.

This is documented, by the way, in mercury_init.h.

> How important are the other arguments to mercury_init? I don't have
> the option of having Mercury at the top level for what I'm doing.
> 
> I'm trying to call Mercury from Java (going through C as glue), and I 
> also get
> a segmentation violation in mercury_init.
> 
>    /* lets get really paranoid about setting up some command line 
> arguments */
>    char* argvv[2];
>    char dummy;
>    argvv[0] = (char*)"java";
>    argvv[1] = (char*)"java";
>    mercury_init(1, argvv, &dummy); /* DIES IN HERE! */

I think you may need to set the last element of argv to NULL,
e.g.

    char* argvv[3];
    char dummy;
    argvv[0] = strdup("java");
    argvv[1] = strdup("java");
    argvv[2] = NULL;
    mercury_init(1, argvv, &dummy); /* DIES IN HERE! */

> In desparation I tried to install one of the non-gc grades of Mercury to see
> if it was a garbage collector conflict, but that doesn't even install.

Another way to test that is to run with the environment
variable MERCURY_OPTIONS set to "-x"; this will disable
the Boehm collector's garbage collection.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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