In the "Writing R Extensions" manual appears this example, to get access to C++ function using the R commands:
R> dyn.load(paste("X", .Platform$dynlib.ext, sep = "")) constructor Y R> .C("X_main") constructor X destructor X list() That gives me access to the function "X_main", but how to get access to methods and properties like X.Z() and X.f, defined in the C++ files: // X.hh class X { public: int f; X (); ~X (); int Z(int a, int b); }; class Y { public: Y (); ~Y (); }; // X.cc #include <iostream> #include "X.hh" static Y y; X::X() { std::cout << "constructor X" << std::endl; } X::~X() { std::cout << "destructor X" << std::endl; } Y::Y() { std::cout << "constructor Y" << std::endl; } Y::~Y() { std::cout << "destructor Y" << std::endl; } X::Z(int a, int b) {return a+b;} // X_main.cc: #include "X.hh" extern "C" { void X_main () { X x; } } // extern "C" Best regards Dr. Adrian Martínez Vargas Revista Minería y Geología (Editor Principal) ISMM, Las Coloradas, s/n Moa, Holguín, Cuba CP. 83329 http://www.ismm.edu.cu/revistamg/index.htm [[alternative HTML version deleted]]
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel