Can swipl.exe load library(pce)?

I have a .pl file with the following content:

:- use_module(library(pce)).

but swipl.exe can not load it:

?- consult([xpce]).
ERROR: e:/work-pl/prolog/code/xpce/
ERROR:    source_sink `library(pce)' does not exist
Warning: e:/work-pl/prolog/code/xpce/
Warning:    Goal (directive) failed: user:use_module(library(pce))

To load this file correctly, I have to use swipl-win.exe instead.

Is there way to workaround it?


P.s. I am using GNU Emacs to edit Prolog files. For console applications, prolog-mode and ediprolog works well with swipl.exe, but for graphics applications, I have to use swipl-win.exe which prolog-mode and ediprolog do not support.

No :frowning: swipl.exe is a Windows console application and swipl-win.exe is a Windows GUI application. The console application cannot use graphics which stops xpce and the GUI application doesn’t have stdio streams Emacs can work with.

This does work on other platforms that do not make this distinction (MacOS, Linux) and thus you can run swipl under Emacs and use graphics.

1 Like

Even if console application cannot use graphics, I would like to at least be able to make swipl.exe load library(pce). Because most of programming time we are just working with data. Graphics are only for final display.

BTW, why console applications cannot use graphics? The other day, I tried plOpenGL which uses graphics. It can work with swipl.exe. For example, in Emcas shell-mode, I can run c:\swipl.exe, it will display a window (there are some problems with prolog-mode and ediprolog though).

I found a workaround in the forum by @he_deceives : XPCE windows freeze with swipl but not swipl-win

I copied and renamed it to the same installation directory, rather than user directory. Of course, this workaround will freeze the window when actually run graphics pp, but at least can it load successfully.

You can simply do copy swipl-win.rc swipl.rc in the install directory of start Prolog using

swipl.exe -F swipl-win

Or add to your file :- use_module(swi('swipl-win.rc')).

It seems that since xpce by default runs in a background thread, swipl.exe is now capable of opening xpce windows. At least ?- emacs. seems to work just fine.

As a side note, there is not that much point in spending time on xpce. Its state is still very unclear. It has some nice properties. It is also very outdated. It is not very likely to be abandoned as the development tools use it and there are quit a few applications out there. The whole thing would need a big overhaul. Think about modern graphics, but also more low-level issues like threading and memory management. That is not very likely to happen any time soon (if ever).

1 Like