aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/embind/emval.js6
-rw-r--r--system/include/emscripten/val.h15
2 files changed, 9 insertions, 12 deletions
diff --git a/src/embind/emval.js b/src/embind/emval.js
index 0fe6404e..1c1365ec 100644
--- a/src/embind/emval.js
+++ b/src/embind/emval.js
@@ -199,13 +199,15 @@ function __emval_as(handle, returnType, destructorsRef) {
return returnType['toWireType'](destructors, handle);
}
-function __emval_call(handle, argCount, argTypes) {
+function __emval_call(handle, argCount, argTypes, argv) {
handle = requireHandle(handle);
var types = lookupTypes(argCount, argTypes);
var args = new Array(argCount);
for (var i = 0; i < argCount; ++i) {
- args[i] = types[i]['fromWireType'](arguments[3 + i]);
+ var type = types[i];
+ args[i] = type['readValueFromVarArg'](argv);
+ argv += type.varArgAdvance;
}
var rv = handle.apply(undefined, args);
diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h
index 5b69e0ff..3d956f24 100644
--- a/system/include/emscripten/val.h
+++ b/system/include/emscripten/val.h
@@ -25,6 +25,8 @@ namespace emscripten {
EM_VAL _emval_undefined();
EM_VAL _emval_null();
EM_VAL _emval_new_cstring(const char*);
+
+ // TODO: make compatible with asm.js
void _emval_take_value(TYPEID type/*, ...*/);
EM_VAL _emval_new(
@@ -39,12 +41,11 @@ namespace emscripten {
void _emval_set_property(EM_VAL object, EM_VAL key, EM_VAL value);
EM_GENERIC_WIRE_TYPE _emval_as(EM_VAL value, TYPEID returnType, EM_DESTRUCTORS* destructors);
- // TODO: make compatible with asm.js
EM_VAL _emval_call(
EM_VAL value,
unsigned argCount,
- internal::TYPEID argTypes[]
- /*, ... */);
+ internal::TYPEID argTypes[],
+ ...);
// DO NOT call this more than once per signature. It will
// leak generated function objects!
@@ -290,14 +291,8 @@ namespace emscripten {
using namespace internal;
WithPolicies<>::ArgTypeList<Args...> argList;
- typedef EM_VAL (*TypedCall)(
- EM_VAL,
- unsigned,
- TYPEID argTypes[],
- typename BindingType<Args>::WireType...);
- TypedCall typedCall = reinterpret_cast<TypedCall>(&_emval_call);
return val(
- typedCall(
+ _emval_call(
handle,
argList.count,
argList.types,