diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | lib.h | 8 | ||||
-rw-r--r-- | syslog.c | 6 |
3 files changed, 21 insertions, 3 deletions
@@ -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. @@ -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 @@ -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) { |