summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTomasz Dąbrowski <[email protected]>2016-11-22 13:59:11 +0100
committerYukihiro "Matz" Matsumoto <[email protected]>2016-11-24 09:28:00 +0900
commit401ad4586ffe8bc26740f49f9049132ad2c50539 (patch)
tree040b77e8f7348394214202ab10829b0fa84381ac
parent1af9e363f28810e46e263cd13da918cdf779d71d (diff)
downloadmruby-401ad4586ffe8bc26740f49f9049132ad2c50539.tar.gz
mruby-401ad4586ffe8bc26740f49f9049132ad2c50539.zip
Add constant export declaration for MRBC output compiled as C++
Otherwise, C++ compilers will skip this constant when producing object files.
-rw-r--r--src/dump.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/dump.c b/src/dump.c
index ea1cd5596..45c595d3b 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -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;