aboutsummaryrefslogtreecommitdiff
path: root/system/lib
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-04-10 23:59:51 -0700
committerJukka Jylänki <jujjyl@gmail.com>2013-04-18 20:08:09 +0300
commit6a4574cfe44b75f8cfaa916a08b402f99baf6cc7 (patch)
treeb9bb8c88e5ce73bddcd96da4897eab07d91ed59c /system/lib
parentbcf017994524b515274344dcf667dc03b8153448 (diff)
Add support for returning std::wstring
Diffstat (limited to 'system/lib')
-rwxr-xr-xsystem/lib/embind/bind.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/system/lib/embind/bind.cpp b/system/lib/embind/bind.cpp
index deb55138..6cacf1e2 100755
--- a/system/lib/embind/bind.cpp
+++ b/system/lib/embind/bind.cpp
@@ -44,6 +44,24 @@ namespace emscripten {
}
}
+// TODO: fix in library.js or a proper emscripten libc
+extern "C" wchar_t *wmemset(wchar_t *dest, wchar_t c, size_t count) {
+ wchar_t *o = dest;
+ while (count--) {
+ *o++ = c;
+ }
+ return dest;
+}
+
+// TODO: fix in library.js or a proper emscripten libc
+extern "C" wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t count) {
+ wchar_t *o = dest;
+ while (count--) {
+ *dest++ = *src++;
+ }
+ return dest;
+}
+
EMSCRIPTEN_BINDINGS(native_and_builtin_types) {
using namespace emscripten::internal;
@@ -64,6 +82,7 @@ EMSCRIPTEN_BINDINGS(native_and_builtin_types) {
_embind_register_float(TypeID<float>::get(), "float");
_embind_register_float(TypeID<double>::get(), "double");
- _embind_register_cstring(TypeID<std::string>::get(), "std::string");
+ _embind_register_std_string(TypeID<std::string>::get(), "std::string");
+ _embind_register_std_wstring(TypeID<std::wstring>::get(), sizeof(wchar_t), "std::wstring");
_embind_register_emval(TypeID<val>::get(), "emscripten::val");
}