From 72dc27f2da0e99ef7a302947dd1d69d65aa268c5 Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Thu, 11 Jun 2009 00:58:58 +0000 Subject: [PATCH] Simple example of adding and dispatching a function variable --- boxedcpp/test.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/boxedcpp/test.cpp b/boxedcpp/test.cpp index 2e8fe4e..d37d9af 100644 --- a/boxedcpp/test.cpp +++ b/boxedcpp/test.cpp @@ -79,6 +79,10 @@ Boxed_Value dynamic_function(BoxedCPP_System &ss, const std::string &name, } } +void test(const std::string &p) +{ + std::cout << "Test: " << p << std::endl; +} //Test main int main() @@ -173,7 +177,11 @@ int main() std::cout << "Result of add function: " << Cast_Helper()(dispatch(ss.get_function("add"), Param_List_Builder() << 5 << 2)) << std::endl; - + + + ss.set_object("myfunc", boost::shared_ptr(new Proxy_Function_Impl >(&test))); + + dispatch(ss.get_function("myfunc"), Param_List_Builder() << std::string("hello function variable")); }