/usr/bin/ld: cannot find -llibswipl
collect2: error: ld returned 1 exit status
looks like i am still missing a last piece …
Btw, running
swipl-ld -o mylib mylib.cpp
Oddly returns the following despite the -o switch:
usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
collect2: error: ld returned 1 exit status
/usr/bin/c++ returned code 256
*** swipl-ld exit status 1
It finally worked. I was able to load the library, after adding a path to the shared file via: 7 ?- assertz(file_search_path(foreign,’/home/dan/trial’)).
re: cout
Looks like i am immediately stumbling over the next issues.
I noticed that within Eclipse PDT, the string sent via cout doesn’t show up.
Yes. Various embeddings do not show cout. Typically you shouldn’t write output from library extensions. For debugging include <SWI-Stream.h> and use Sdprintf(), providing the usual printf() conventions (and some additional ones). This header provides interaction with the SWI-Prolog streams. There is no C++ binding
Several probably, but one on how to compile and link an extension on various platforms can be quite useful. Notably on Windows it is a bit of a challenge