1

I am trying to host XSB in a server. I wrote the following code:

:- module(server, [server/0, server/1]).
:- import http_server/2 from library(http/thread_httpd).
:- import http_dispatch/1 from library(http/http_dispatch).
:- use_module(swish, []).

server :-
    server(localhost:3050).

server(Port) :-
    http_server(http_dispatch,
            [ port(Port),
              workers(16)
            ]).

I am getting the following error

    [xsb_configuration loaded]
    [sysinitrc loaded]
    [xsbbrat loaded]
    [Compiling ./server]
    ++Warning[XSB]: [Compiler] ./server : Unused symbol http_dispatch/1
    ++Warning[XSB]: [Compiler] ./server : Unused symbol swish/0
    ++Warning[XSB]: [Compiler] ./server : Unused symbol library(http / http_dispatch)/0
    ++Error[XSB/Runtime/P]: [Type (library(http / thread_httpd) in place of atom)] in arg 1 of predicate atom_length/2
    Forward Continuation...
    ... asmpass2:asm_putsym/2

Can someone please tell me what I doing wrong here. Your help is greatly appreciated.

UnderWood
  • 803
  • 3
  • 12
  • 23
  • I saw your previous question already. I would have liked to answer, but I did not easily find any useful online documentation for XSB Prolog. Are you sure that those libraries you are trying to load are available, and that this is the correct way to load them? As far as I am aware, the whole http package is part of the SWI-Prolog distribution; I really don't know if it is available for XSB Prolog, or if its source is compatible with XSB Prolog. –  Nov 18 '16 at 09:22

1 Answers1

3

You cannot use SWI-Prolog HTTP libraries with XSB. Those libraries rely on SWI-Prolog proprietary features and will not work as-is in XSB. Porting the libraries is not a trivial task either, starting with the fact the module system in SWI-Prolog is predicate-based while the module system in XSB is atom-based.

Paulo Moura
  • 18,373
  • 3
  • 23
  • 33