This is the mail archive of the
guile@sourceware.cygnus.com
mailing list for the Guile project.
Another const PATCH plus problems with gh_new_procedure
- To: Guile Mailing List <guile at sourceware dot cygnus dot com>
- Subject: Another const PATCH plus problems with gh_new_procedure
- From: Dirk Herrmann <dirk at ida dot ing dot tu-bs dot de>
- Date: Thu, 9 Dec 1999 10:17:43 +0100 (MET)
Since I'm using guile in combination with C++, the switch to the latest gcc
requires to fix some constness problems. Thus I stumbled across the problems
in my latest patch, and also across the following:
diff -u -p -r1.21 gh.h
--- gh.h 1999/11/19 18:16:19 1.21
+++ gh.h 1999/12/09 08:58:04
@@ -104,7 +104,7 @@ SCM gh_long2scm(long x);
SCM gh_double2scm(double x);
SCM gh_char2scm(char c);
SCM gh_str2scm(char *s, int len);
-SCM gh_str02scm(char *s);
+SCM gh_str02scm(const char *s);
void gh_set_substr(char *src, SCM dst, int start, int len);
SCM gh_symbol2scm(const char *symbol_str);
SCM gh_ints2scm(int *d, int n);
diff -u -p -r1.23 gh_data.c
--- gh_data.c 1999/11/19 18:16:19 1.23
+++ gh_data.c 1999/12/09 08:58:04
@@ -87,7 +87,7 @@ gh_str2scm (char *s, int len)
return scm_makfromstr (s, len, 0);
}
SCM
-gh_str02scm (char *s)
+gh_str02scm (const char *s)
{
return scm_makfrom0str (s);
}
However, there appears another problem that is not easy to fix (at least for
me), and for which I would like to ask people from the list for help:
SWIG has generated the following code:
gh_new_procedure("foo", _wrap_gscm_foo, 3, 0, 0);
where _wrap_gscm_foo has the following prototype:
SCM _wrap_gscm_foo(SCM s_0,SCM s_1,SCM s_2);
Then the C++ compiler complains:
ANSI C++ prohibits conversion from `(long int, long int, long int)' to `(...)'
The reason is, that gh_new_procedure accepts any function as its second
parameter: SCM (*fn)(), which basically means SCM (*fn)(...). However, for
ANSI C++ it seems not to be allowed to pass a SCM (*fn)(SCM,SCM,SCM) as a
parameter when a SCM (*fn)(...) is required.
Wrapping include<gh.h> with extern "C" did not help.
Any ideas for a solution?
Dirk Herrmann