Fix multiple definitions of a global variable when using the C interface with a C++ compiler (#9176)
The `CAML_STATIC_ASSERT` declares a global variable which was neither `static` nor `extern`. Multiple uses of the macro cause multiple variables with the same name, which are accepted under the "common" C model but are rejected in C++ and in some C compilers that don't use the "common" model. The fix is to declare the variable `extern`.master
parent
718ace537e
commit
289521b977
|
@ -145,7 +145,7 @@ extern caml_timing_hook caml_finalise_begin_hook, caml_finalise_end_hook;
|
|||
|
||||
#define CAML_STATIC_ASSERT_3(b, l) \
|
||||
CAMLunused_start \
|
||||
char static_assertion_failure_line_##l[(b) ? 1 : -1] \
|
||||
CAMLextern char static_assertion_failure_line_##l[(b) ? 1 : -1] \
|
||||
CAMLunused_end
|
||||
|
||||
#define CAML_STATIC_ASSERT_2(b, l) CAML_STATIC_ASSERT_3(b, l)
|
||||
|
|
Loading…
Reference in New Issue