summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--lib.h8
-rw-r--r--syslog.c6
3 files changed, 21 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 216038b4..7ddfd2e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2015-08-07 Kaz Kylheku <kaz@kylheku.com>
+ C++ static forward issue.
+
+ * lib.h (static_forward, static_def): New macros
+ for dealing with C++ static forward declaration problem.
+
+ * syslog.c (syslog_strm_ops): Use static
+ forward macros.
+
+2015-08-07 Kaz Kylheku <kaz@kylheku.com>
+
C++ upkeep: resolve multiple definitions of fun_k.
* eval.c (fun_k): Global definition removed.
diff --git a/lib.h b/lib.h
index fd05954f..85f0b6e2 100644
--- a/lib.h
+++ b/lib.h
@@ -954,3 +954,11 @@ loc list_collect_append(loc pptail, val obj);
#define negone num_fast(-1)
#define maxint num_fast(NUM_MAX)
#define minint num_fast(NUM_MIN)
+
+#ifdef __cplusplus
+#define static_forward(decl) namespace { extern decl; }
+#define static_def(def) namespace { def; }
+#else
+#define static_forward(decl) static decl;
+#define static_def(def) static def;
+#endif
diff --git a/syslog.c b/syslog.c
index 0cb1d80e..248c3b5b 100644
--- a/syslog.c
+++ b/syslog.c
@@ -51,7 +51,7 @@ struct syslog_strm {
val prio_k;
-static struct strm_ops syslog_strm_ops;
+static_forward(struct strm_ops syslog_strm_ops)
void syslog_init(void)
{
@@ -212,7 +212,7 @@ static val syslog_set_prop(val stream, val ind, val prop)
return nil;
}
-static struct strm_ops syslog_strm_ops =
+static_def(struct strm_ops syslog_strm_ops =
strm_ops_init(cobj_ops_init(eq,
stream_print_op,
cobj_destroy_stub_op,
@@ -225,7 +225,7 @@ static struct strm_ops syslog_strm_ops =
0, 0, 0, 0, 0, 0, 0, 0,
syslog_get_prop,
syslog_set_prop,
- 0, 0, 0);
+ 0, 0, 0))
val make_syslog_stream(val prio)
{