[Rd] Problems with MinGW and boost on Windows

Florian Burkart florian.burkart at gmail.com
Tue Nov 27 19:01:33 CET 2012


Sorry, didn't realize text attachments get stripped as well... here is
a link: http://pastebin.com/T3XhsjDY, and for the archives the actual
text

#define WIN32_LEAN_AND_MEAN
#define NOMINMAX 1
#define _WIN32_WINNT 0x0601
#define NTDDI_VERSION 0x06010000
#define _MSC_VER_WINNT _MSC_VER_WINNT_WIN7

#include <Rcpp.h>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/filesystem.hpp>

struct World {
World() { Rprintf("Hello World.\n"); }
~World() { Rprintf("Goodbye World.\n"); }
};
World myWorld;

extern "C" {
SEXP add(SEXP symName);
}

SEXP add( SEXP x )
{
Rcpp::NumericVector xx(x);
return Rcpp::wrap( std::accumulate( xx.begin(), xx.end(), 0.0));
}

#define NVP(x) boost::serialization::make_nvp(#x,x)

class Dummy {
public:
int a;
Dummy() { }
template<class Archive>
    void serialize(Archive& ar, const unsigned int) { ar & NVP(a); }
};

class DummyReader
{
std::ifstream myifstream;
boost::archive::binary_iarchive ar;
public:
DummyReader(std::string const& filename) :
myifstream(filename,std::ios_base::in | std::ios_base::binary),
ar(myifstream) { }
Dummy* Read() { Dummy* item; try {ar & NVP(item); } catch
(boost::archive::archive_exception const&) { item=0; } return item; }
};



More information about the R-devel mailing list