Is there a workaround to make ensure_loaded/1 work in B-Prolog as it works in many other Prolog systems? The goal is to have a preamble so that the rest of code can use ensure_loaded/1 independent of whether which Prolog system I use.
- It seems that it does not resolve a relative path to the currently consulted file, as many Prolog systems do.
- It seems that it does not allow a Prolog text but expects some byte code, which would force me to compile stuff.
So I tried the following:
:- set_prolog_flag(redefine_builtin, on).
ensure_loaded(X) :-
atom_concat('<base>\\',X,Y),
consult(Y).
:- set_prolog_flag(redefine_builtin, off).
But when a Prolog text with the following directive is consulted, I wont work:
:- ensure_loaded('suite.p').
It still doesn't find suite.p.
What could I do?
Bye
Regarding the expansion of paths, in the Logtalk adapter file for B-Prolog I (must) use:
It's basically an hack (that can be improved by e.g. trying to find first in which OS you're running) for missing functionality that should be provided by B-Prolog itself.