On 30 January 2005 at 18:03, Faheem Mitha wrote: | Consider the following file. | | ******************************* | foo.cc | ******************************* | #include <R.h> | #include <Rinternals.h> | #include <iostream> | ******************************* | | R CMD SHLIB foo.cc
Two changes are required: You absolutely do need extern "C" ... to get C headers in with C++, and the other is a simple reordering -- not sure where I learned that can help at times ... [EMAIL PROTECTED]:/tmp> cat foo.cc #include <iostream> extern "C" { #include <R.h> #include <Rinternals.h> } [EMAIL PROTECTED]:/tmp> R CMD SHLIB foo.cc g++ -shared -o foo.so foo.o -L/usr/lib/R/lib -lR [EMAIL PROTECTED]:/tmp> ls -l foo.so -rwxr-xr-x 1 edd edd 117872 Jan 30 17:16 foo.so [EMAIL PROTECTED]:/tmp> Hth, Dirk -- Better to have an approximate answer to the right question than a precise answer to the wrong question. -- John Tukey as quoted by John Chambers ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html