Permalink
Browse files

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

Otherwise, C++ compilers will skip this constant when producing object files.
  • Loading branch information...
dabroz authored and matz committed Nov 22, 2016
1 parent 1af9e36 commit 401ad4586ffe8bc26740f49f9049132ad2c50539
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/dump.c
View
@@ -1059,13 +1059,15 @@ 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"
"#elif defined _MSC_VER\n"
"__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;

0 comments on commit 401ad45

Please sign in to comment.