User-defined Main Programs

Runtime systems may or may not have an automatically generated main program. This is controlled by the --main option to spld. If --main=user is given, a function user_main() must be supplied:

     int user_main(int argc, char *argv[])
     

user_main() is responsible for initializing the Prolog engine, loading code, and issuing any Prolog queries. And alternative is to use --main=none and write your own main() function.