* get the underlying C++ function pointer as a DL_FUNC */
| 177 | * get the underlying C++ function pointer as a DL_FUNC |
| 178 | */ |
| 179 | inline DL_FUNC get_function_ptr( const std::string& name_ ){ |
| 180 | MAP::iterator it = functions.begin() ; |
| 181 | size_t n = functions.size() ; |
| 182 | CppFunction* fun = 0 ; |
| 183 | for( size_t i=0; i<n; i++, ++it){ |
| 184 | if( name_.compare( it->first ) == 0){ |
| 185 | fun = it->second ; |
| 186 | break ; |
| 187 | } |
| 188 | } |
| 189 | return fun->get_function_ptr() ; |
| 190 | } |
| 191 | |
| 192 | inline void Add( const char* name_ , CppFunction* ptr){ |
| 193 | R_RegisterCCallable( prefix.c_str(), name_, ptr->get_function_ptr() ) ; |