aboutsummaryrefslogtreecommitdiff
path: root/tests/embind/embind_test.cpp
diff options
context:
space:
mode:
authorJukka Jylanki <jjylanki@imvu.com>2013-04-02 15:35:36 +0300
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:27:16 +0300
commit616b5c3579556c5e1be6ba1063c132680d9e2d43 (patch)
tree059a46d5139ace34c42f9ee669370e1cc7f22d8e /tests/embind/embind_test.cpp
parent783c443cc84ca990e181b07f2ba7f310368d9b75 (diff)
Add support for registering overloads of free functions based on argument count.
Diffstat (limited to 'tests/embind/embind_test.cpp')
-rw-r--r--tests/embind/embind_test.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/embind/embind_test.cpp b/tests/embind/embind_test.cpp
index f23b9152..0ae1801a 100644
--- a/tests/embind/embind_test.cpp
+++ b/tests/embind/embind_test.cpp
@@ -1339,6 +1339,19 @@ public:
}
};
+int overloaded_function(int i)
+{
+ assert(i == 10);
+ return 1;
+}
+
+int overloaded_function(int i, int j)
+{
+ assert(i == 20);
+ assert(j == 20);
+ return 2;
+}
+
EMSCRIPTEN_BINDINGS(tests) {
register_js_interface();
@@ -1785,6 +1798,9 @@ EMSCRIPTEN_BINDINGS(tests) {
function("long_to_string", &long_to_string);
function("unsigned_long_to_string", &unsigned_long_to_string);
+ function("overloaded_function", (int(*)(int))&overloaded_function);
+ function("overloaded_function", (int(*)(int, int))&overloaded_function);
+
class_<MultipleCtors>("MultipleCtors")
.constructor<int>()
.constructor<int, int>()