#define END_VARIABLES { NULL, SCM_BOOL_F, NULL }
+#ifdef __cplusplus
+
+/* Although scm_t_subr is meant to hold a function pointer, at least
+ in some versions of guile, it is actually a typedef to "void *".
+ That means that in C++, an explicit cast is necessary to convert
+ function pointer to scm_t_subr. But a cast also makes it possible
+ to pass function pointers with the wrong type by mistake. So
+ instead of adding such casts throughout, we use 'as_a_scm_t_subr'
+ to do the conversion, which (only) has overloads for function
+ pointer types that are valid.
+
+ See https://lists.gnu.org/archive/html/guile-devel/2013-03/msg00001.html.
+*/
+
+static inline scm_t_subr
+as_a_scm_t_subr (SCM (*func) (void))
+{
+ return (scm_t_subr) func;
+}
+
+static inline scm_t_subr
+as_a_scm_t_subr (SCM (*func) (SCM))
+{
+ return (scm_t_subr) func;
+}
+
+static inline scm_t_subr
+as_a_scm_t_subr (SCM (*func) (SCM, SCM))
+{
+ return (scm_t_subr) func;
+}
+
+static inline scm_t_subr
+as_a_scm_t_subr (SCM (*func) (SCM, SCM, SCM))
+{
+ return (scm_t_subr) func;
+}
+
+#else
+
+/* In C, just do an implicit conversion. */
+#define as_a_scm_t_subr(func) func
+
+#endif
/* Scheme functions to define during initialization. */
typedef struct