[mercury-users] using univ with C

QRL_Charles QRL_Gretton g12.charles.gretton at gmail.com
Thu Jun 5 12:07:55 AEST 2008

Q: How can I access the data of a Mercury ":-type univ" in C?

If my question doesn't make sense, the following might explain what
I'm after a bit better.

Imagine if "univ" was a C void pointer. Then, for a Mercury interface
to a dynamically polymorphic list in C, I could have:

:- pred push_back_c_vector(univ::in, c_vector::in, int_store::mdi,
int_store::muo) is det.

:- pragma foreign_proc("C",
        push_back_c_vector(Univ::in, Vector_In::in,S0::mdi, S::muo),
		      Vector_In->push_back(Vector_In, Univ);
		      S = S0;


cpu :: Intel(R) Core(TM)2 Duo CPU (x86_64)

mercury :: Mercury Compiler, version rotd-2008-05-07, configured for

mercury -- configure :: ./configure --prefix=`pwd`

gcc :: gcc version 4.1.3

amuse :: Hervé This was what Edward Said John Donne to the Terry Nation

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