[PPL-devel] Is the functor `main' special? Is Cygwin special?

Roberto Bagnara bagnara at cs.unipr.it
Thu Dec 23 14:44:20 CET 2004


Hi there,

I am confused.  Everything started when I tried to do un Cygwin what
I usually do under GNU/Linux.  I have a makefile rule that builds
a stand-alone application as follows:

pl_clpq$(EXEEXT): ppl_swiprolog.o pl_clpq.o pl_clpq.pl ../tests/clpq.pl
         plld -cc $(CC) -c++ $(CXX) -ld $(CXX) -pl-options,-g,main., -o $@ $+ \
                 -L$(top_builddir)/src/.libs -lppl \
                 -L$(top_builddir)/Watchdog/.libs -lpwl \
                 @extra_libraries@

Notice the option `-pl-options,-g,main.,', which, unless I am mistaken,
means that main/0 is the goal to be executed at startup.  (I am not sure
the final dot and comma should be there, by the way.)  While the application
built that way runs happily under GNU/Linux, under Cygwin it dies
because, while main/0 it is defined, main/1 is not.  However,
accorting to the `-pl-options' above, main/0 should be called,
not main/1: I don't understand who is looking for main/1 and why.
So I made a couple of experiment on GNU/Linux and the result is confusing:

$ pl -g main
ERROR: Undefined procedure: main/1
ERROR:     However, there are definitions for:
ERROR:         main/0
$ pl -g main.
ERROR: Undefined procedure: main/1
ERROR:     However, there are definitions for:
ERROR:         main/0
$ pl -g foo
ERROR: Prolog initialisation failed:
ERROR: Undefined procedure: foo/0
$ pl -g foo.
ERROR: Prolog initialisation failed:
ERROR: Undefined procedure: foo/0

What is going on?
All the best,

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list