summaryrefslogtreecommitdiffhomepage
path: root/include/mruby.h
diff options
context:
space:
mode:
authorTomasz Dąbrowski <[email protected]>2016-11-22 13:19:05 +0100
committerYukihiro "Matz" Matsumoto <[email protected]>2016-11-24 09:28:00 +0900
commit1af9e363f28810e46e263cd13da918cdf779d71d (patch)
treeb0bc03c71721bc62a5435111c3bf0f9c9dc0ce0d /include/mruby.h
parent477e12c1821b5d6c845b5c80c7dd238bebc61f73 (diff)
downloadmruby-1af9e363f28810e46e263cd13da918cdf779d71d.tar.gz
mruby-1af9e363f28810e46e263cd13da918cdf779d71d.zip
Fixes for compiling mruby as C++
Diffstat (limited to 'include/mruby.h')
-rw-r--r--include/mruby.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/mruby.h b/include/mruby.h
index e6eaf7f27..d40dce6d9 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -28,10 +28,26 @@
#ifndef MRUBY_H
#define MRUBY_H
+#ifdef __cplusplus
+#define __STDC_LIMIT_MACROS
+#define __STDC_CONSTANT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+
#include <stdint.h>
#include <stddef.h>
#include <limits.h>
+#ifdef __cplusplus
+#ifndef SIZE_MAX
+#ifdef __SIZE_MAX__
+#define SIZE_MAX __SIZE_MAX__
+#else
+#define SIZE_MAX std::numeric_limits<size_t>::max()
+#endif
+#endif
+#endif
+
#ifdef MRB_DEBUG
#include <assert.h>
#define mrb_assert(p) assert(p)