Re: foreign resources
Olivier Sallou <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On 02/26/2014 03:16 PM, Jan Wielemaker wrote:
> 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>
>
Ok, I tried to find the PREDICATE declaration but did not find any.
SWI-cpp.h is not installed on Ubuntu. This part may not be packaged.
Olivier
> 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
>>
>
>
>
--
Olivier Sallou
IRISA / University of Rennes 1
Campus de Beaulieu, 35000 RENNES - FRANCE
Tel: 02.99.84.71.95
gpg key id: 4096R/326D8438 (keyring.debian.org)
Key fingerprint = 5FB4 6F83 D3B9 5204 6335 D26D 78DC 68DB 326D 8438