Re: foreign resources

Jan Wielemaker <[email protected]>
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
On 02/26/2014 01:56 PM, Olivier Sallou wrote:
> Hi,
> I am trying to mix C++ and prolog (Prolog calling C++) with foreign
> resources but I have compilation issues, though following the documentation.
> I tried to use the PREDICATE macro, but it sems to fail. Any idea of
> waht is going wrong?
>
> I am using swi-pl on Ubuntu: SWI-Prolog version 5.10.4 for amd64
>
> Here is my source file cassiopee.cpp:
>
> #include <SWI-Prolog.h>

#include <SWI-cpp.h>

	Cheers --- Jan

>
> PREDICATE(hello, 1)
> { cout << "Hello " << (char *)A1 << endl;
>
>    return TRUE;
> }
>
> And here is my compilation log/error:
>
> /swi$ swipl-ld -v  cassiopee.cpp
>
> eval `swipl --dump-runtime-variables`
> 		CC="gcc"
> 		PLBASE="/usr/lib/swi-prolog"
> 		PLARCH="amd64"
> 		PLLIBS="-lgmp -lrt -lreadline -lncurses -lm -lrt -ldl"
> 		PLLIB="-lswipl"
> 		PLCFLAGS="-pthread -fPIC"
> 		PLLDFLAGS="-rdynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -pthread"
> 		PLSOEXT="so"
> 		PLTHREADS="yes"
> 	g++ -c -pthread -fPIC -D_REENTRANT -D__SWI_PROLOG__ -D__SWI_EMBEDDED__ -I/usr/lib/swi-prolog/include -o cassiopee.o cassiopee.cpp
> cassiopee.cpp:12:10: error: expected constructor, destructor, or type conversion before '(' token
> g++ returned code 256
> *** swipl-ld exit status 1
>
>
>
> Thanks
>
> Olivier
>
>
> -- gpg key id: 4096R/326D8438 (keyring.debian.org) Key fingerprint =
> 5FB4 6F83 D3B9 5204 6335 D26D 78DC 68DB 326D 8438
> -------------- next part --------------
> HTML attachment scrubbed and removed
> _______________________________________________
> SWI-Prolog mailing list
> [email protected]
> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.