
Hi there,
I am interfacing a C++ library to GNU Prolog and I have encountered a couple of problems. The first is due to the fact that gprolog.h uses a the C++ reserved identifier `template'. It does that at line 639:
char *M_Mktemp(char *template);
Notice that this problem is not solved by replacing
#include <gprolog.h>
with
extern "C" { #include <gprolog.h> }
One may indeed resort to the ugly
extern "C" { #define template templ #include <gprolog.h> #undef template }
but I believe avoiding using any C++ reserved identifier is a much better solution. While we are at it, we may wish to make the C++ user's life a bit simpler by enclosing gprolog.h withing
#ifdef __cplusplus extern "C" { #endif
and
#ifdef __cplusplus } #endif
The header gprolog.h has the multiple inclusion guard
#ifndef _GP_CONFIG_H #define _GP_CONFIG_H
...
#endif
but the guard's #endif is, in the case of gprolog.h NOT at the end of the file (why?). As a result, if gprolog.h is included twice you get tons of redefinition errors. Can this be fixed?
The last problem concerns the installation of gprolog.h: it is not put in any path where C/C++ compilers would look for it. While it is OK to have it in
$prefix/gprolog-1.2.8/include/gprolog.h
it would be handy if the installation procedure could set up a symbolic link to it in, say,
$prefix/include/gprolog.h
(unless the user explicitely requests something else, of course).
I enclose a patch to gprolog.h for the template, C++ and inclusion guard problems. All the best,
Roberto
participants (1)
-
Roberto Bagnara