summaryrefslogtreecommitdiffhomepage
path: root/tasks
diff options
context:
space:
mode:
authorTomasz Dąbrowski <[email protected]>2016-11-22 13:19:53 +0100
committerYukihiro "Matz" Matsumoto <[email protected]>2016-11-24 09:28:00 +0900
commit18757c8f7be05d9bc8d850180ada4d3fa1fc018d (patch)
tree25d55e0fc64d5fbf847a042fe3cb75a036550976 /tasks
parent00e61212600c53e9c4f1629a6e3bcb93422417c2 (diff)
downloadmruby-18757c8f7be05d9bc8d850180ada4d3fa1fc018d.tar.gz
mruby-18757c8f7be05d9bc8d850180ada4d3fa1fc018d.zip
Different method of compiling C as C++ (-x c++)
Diffstat (limited to 'tasks')
-rw-r--r--tasks/mruby_build.rake5
1 files changed, 5 insertions, 0 deletions
diff --git a/tasks/mruby_build.rake b/tasks/mruby_build.rake
index cff45ddf8..cde996aae 100644
--- a/tasks/mruby_build.rake
+++ b/tasks/mruby_build.rake
@@ -120,6 +120,7 @@ module MRuby
def enable_cxx_abi
return if @cxx_exception_disabled or @cxx_abi_enabled
compilers.each { |c| c.defines += %w(MRB_ENABLE_CXX_EXCEPTION) }
+ compilers.each { |c| c.flags << '-x c++'}
linker.command = cxx.command if toolchains.find { |v| v == 'gcc' }
@cxx_abi_enabled = true
end
@@ -135,9 +136,13 @@ module MRuby
#define __STDC_CONSTANT_MACROS
#define __STDC_LIMIT_MACROS
+#ifndef MRB_ENABLE_CXX_EXCEPTION
extern "C" {
+#endif
#include "#{src}"
+#ifndef MRB_ENABLE_CXX_EXCEPTION
}
+#endif
#{src == "#{MRUBY_ROOT}/src/error.c"? 'mrb_int mrb_jmpbuf::jmpbuf_id = 0;' : ''}
EOS