[mercury-users] C interface with main in C

Simon Taylor stayl at cs.mu.OZ.AU
Fri Feb 22 01:38:52 AEDT 2002

On 21-Feb-2002, Gustavo Ospina <gos at info.ucl.ac.be> wrote:
> I want to use the C interface to use Mercury exported predicates in a C module,
> but conserving the main function in C.

> When I link just the two modules (with the one generated by c2init) the linker
> says that there are an undefined reference to the predicate main/2. So, I've
> tried to fix by writing a 'dummy' mercury module with an empty main predicat.
> The linker generated the executable successfully but in the execution, nothing
> is printed.

Add a line `C2INITFLAGS = --library' to your Mmakefile.

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