Skip to content

swipl-ld ignores "-goal true" if there's no .pl file #94

@kamahen

Description

@kamahen

In the following main.pl is an empty file. If it's specified, swipl-ld honours the -goal true and if it's not specified, I get the standard SWI-Prolog banner.

$ swipl-ld -goal true main.cpp main.pl && ./a.out  3.14 a b c ; echo $?
% Disabled autoloading (loaded 34 files)
% Disabled autoloading (loaded 7 files)
% Disabled autoloading (loaded 0 files)
% halt
[./a.out,3.14,a,b,c]
0
$ swipl-ld -goal true main.cpp && ./a.out  3.14 a b c ; echo $?
Welcome to SWI-Prolog (threaded, 64 bits, version 9.3.14-DIRTY)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit https://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

[./a.out,3.14,a,b,c]
0
$ cat main.cpp
#include "SWI-cpp2.h"
#include <iostream>

int
main(int argc, char *argv[])
{ PlEngine e(argv[0]);
  PlTermv av(1);
  PlTerm_tail l(av[0]);

  for(int i=0; i<argc; i++)
    PlCheckFail(l.append(PlTerm_string(argv[i])));
  PlCheckFail(l.close());

  PlQuery q("writeln", av);
  try
  { return q.next_solution() ? 0 : 1;
  } catch ( PlException &ex )
  { std::cerr << ex.what() << std::endl;
    return 1;
  }
}
$ cat main.pl
$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions