Hello, I want to use a C++ library under R, but I have problems. I have readen the manual: "Writing R Extensions" and the setion " Interfacing C++ code". I have created : //X.cpp #include "X.h" #include <iostream> X::X() { std::cout << "constructor X" << std::endl; } X::~X() { } //X.h #ifndef X_H #define X_H class X { public: X(); ~X(); }; #endif //X_main.cpp #include "X.h" extern "C" { void X_main(){ X x; } } //essai.R foo<-function() {.C("X_main");} When I execute the file essai.R, the R console returns: Error in .C("X_main") : C function name not in load table. If you can help me. Thank you. Sandrine
> Hello, > I want to use a C++ library under R, but I have problems. > I have readen the manual: "Writing R Extensions" and the setion " Interfacing C++ code". > I have created : > //X.cpp > #include "X.h" > #include <iostream> > > X::X() > { > std::cout << "constructor X" << std::endl; > } > > X::~X() > { > } > > > //X.h > #ifndef X_H > #define X_H > > class X > { > public: > X(); > > ~X(); > }; > #endif > > //X_main.cpp > #include "X.h" > > extern "C" { > > void X_main(){ > X x; > } > } > > > //essai.Rdid you load the shared library via dyn.load("X_main.so") ? Torsten> foo<-function() > {.C("X_main");} > > When I execute the file essai.R, the R console returns: > > Error in .C("X_main") : C function name not in load table. > > If you can help me. > Thank you. > > Sandrine > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-devel > >