[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: prolog and c++
From: |
Erick Alphonse |
Subject: |
Re: prolog and c++ |
Date: |
Fri, 04 Oct 2002 20:37:23 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 |
eric pramudya wrote:
Hi,
I want to ask you a question on how to 'link' a prolog program to C++. I
use C++ as interface (OO). I'm using a Qt Designer (auto code generated)
to build this interface.
Hello,
You have just to include gprolog.h in your source code as it is
compatible with C++. As Timo said, put extern "C" {} around your C++
procedures that need to be called by gprolog.
You may have problems with multiple inclusions of "gprolog.h". In that
case, I hope the following will help you out (I don't know if it's fixed
in gprolog-1.2.15).
Cheers,
Erick.
> There are no
> longer guards preventing multiple inclusion of the lines as opposed to
> gprolog 1.2.9 (see below). I modified directly gprolog.h in the final
> include directory by copying-pasting the relevant code from gprolog
> 1.2.9, and everything compiles now (actually, this code for gprolog.h is
> generated from src/BipsPl/bc_supp.h and src/BipsPl/parse_supp.h, but
> there is a comment saying that it's more complicated this way ;)).
>
> gprolog.h version 1.2.14
>
> #ifdef PARSE_SUPP_FILE
> InfVar parse_dico_var[MAX_VAR_IN_TERM];
> int parse_nb_var;
> #else
> extern InfVar parse_dico_var[];
> extern int parse_nb_var;
> #endif
> int last_read_line;
> int last_read_col;
>
> #ifdef BC_SUPP_FILE
> int byte_len;
> #else
> extern int byte_len;
> #endif
> unsigned *byte_code;
>
> gprolog.h version 1.2.9
>
> #ifdef PARSE_SUPP_FILE
> InfVar parse_dico_var[MAX_VAR_IN_TERM];
> int parse_nb_var;
> int last_read_line;
> int last_read_col;
> #else
> extern InfVar parse_dico_var[];
> extern int parse_nb_var;
> extern int last_read_line;
> extern int last_read_col;
> #endif
>
> #ifdef BC_SUPP_FILE
> unsigned *byte_code;
> int byte_len;
> #else
> extern unsigned *byte_code;
> extern int byte_len;
> #endif
>