[mercury-users] Compiled a library, linked to a program... but no calls are performed

Ondrej Bojar oboj7042 at ss1000.ms.mff.cuni.cz
Fri Mar 7 01:31:46 AEDT 2003


I've succeeded with compiling a library of core functions out of a very
messy code (of mine and others, C and C++ as well).

I didn't install the library, but in a different directory, I prepared a
Mmakefile with some options that let me use the library even if not

(These are the options, I do not really know, what VPATH and C2INITARGS
are, and how EXTRA_* interact together, but anyway, it compiles.)

# Tell Mercury to use the "core" ent library
EXTRA_INIT_DIRS = $(merctools_dir)
VPATH = $(merctools_dir):$(MMAKE_VPATH)
MCFLAGS= -I$(merctools_dir) -I$(share_dir) $(EXTRA_MCFLAGS)
MGNUCFLAGS = --c-debug --no-c-optimize -I$(merctools_dir) -I$(share_dir) -I$(db_dir)
MLFLAGS= --c-debug -R$(merctools_dir) -L$(merctools_dir) $(EXTRA_MLFLAGS)
C2INITARGS= $(merctools_dir)/core.init

Then, in the main program, I do:

:- module chatter.
:- import_module debugstr.

main -->
  debugstr("Chatter started.\n"),

The debugstr module performs unsafe impure io, and should dump the string
to the stdout. I use this module *very* often in the source messy code, so
that I've added it to the library as well.

As I've said, it compiles and links without errors.

However, the program produces only this output:

obo at nats47:chatter $ ./chatter

No routines from the library are ever called. (There are others, not just

Would you please help me?

Thanks a lot, Andrew.

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