bug-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gprolog extended via C interface ignores command-line interface argu


From: Daniel Diaz
Subject: Re: gprolog extended via C interface ignores command-line interface arguments
Date: Tue, 9 Jan 2018 16:04:54 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0

Hi Simon,

sorry for the late reply.

The top-level is a specific application which its own main() (testing filtering command-line arguments to handle some like --query-goal).
It is not the case of user defined application for which the default main() does not scan the command-line (the user is free to use any command).
Your executable is such an application, only the default main() is used.

To provide an executable with your own C code which behaves like the actual top-level (resulting in an augmented top-level with new functionalities built-in) it is necessary to add a compiler option (e.g. --new-top-level) to force the inclusion of the top-level main().
Do you need this ?

Daniel



Le 02/12/2017 à 07:14, Simon Curry a écrit :

Hi,

I am using:

GNU Prolog 1.4.4 (64 bits)
Compiled Dec  1 2017, 19:56:55 with gcc
By Daniel Diaz
Copyright (C) 1999-2013 Daniel Diaz

running on a ubuntu machine:

Linux simon-Leopard-Extreme 4.4.0-98-generic #121-Ubuntu SMP Tue Oct 10 14:24:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

I am extending gprolog with a significant library of crypto functions in C and in general this works very well. The only exception is that the new instance of gprolog, extended with these functions ignores the '--init-goal', '--query-goal' command line arguments. These are useful for running the prolog application from a cron job, for example.

"Fortunately", your own example in /usr/local/gprolog-1.4.4/examples/ExamplesC manifests the same problem, so I need not burden you with all of my code.

For example, when I build your example and compare the operation of the new executable with that of the base gprolog, I get:


address@hidden:ExamplesC$ gprolog --query-goal "format('Hi Mom', [])"
GNU Prolog 1.4.4 (64 bits)
Compiled May 15 2017, 21:17:39 with gcc
By Daniel Diaz
Copyright (C) 1999-2013 Daniel Diaz
| ?- format('Hi Mom', []).
Hi Mom

yes
| ?-

address@hidden:ExamplesC$ ./examp --query-goal "format('Hi Mom', [])"
GNU Prolog 1.4.4 (64 bits)
Compiled May 15 2017, 21:17:39 with gcc
By Daniel Diaz
Copyright (C) 1999-2013 Daniel Diaz
| ?-

Everything else works perfectly. Have I misunderstood what is supposed to happen or is this a bug?

Regards

Simon Curry



_______________________________________________
Bug-prolog mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-prolog



reply via email to

[Prev in Thread] Current Thread [Next in Thread]