Add constant export declaration for MRBC output compiled as C++

Otherwise, C++ compilers will skip this constant when producing object files.
This commit is contained in:
Tomasz Dąbrowski
2016-11-22 13:59:11 +01:00
committed by Yukihiro "Matz" Matsumoto
parent 1af9e363f2
commit 401ad4586f
+2
View File
@@ -1059,6 +1059,7 @@ mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE *fp, con
return MRB_DUMP_WRITE_FAULT;
}
if (fprintf(fp,
"extern const uint8_t %s[];\n"
"const uint8_t\n"
"#if defined __GNUC__\n"
"__attribute__((aligned(%u)))\n"
@@ -1066,6 +1067,7 @@ mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE *fp, con
"__declspec(align(%u))\n"
"#endif\n"
"%s[] = {",
initname,
(uint16_t)MRB_DUMP_ALIGNMENT, (uint16_t)MRB_DUMP_ALIGNMENT, initname) < 0) {
mrb_free(mrb, bin);
return MRB_DUMP_WRITE_FAULT;