Re: [Rd] Problems with MinGW and boost on Windows

From: Florian Burkart <florian.burkart_at_gmail.com>
Date: Tue, 27 Nov 2012 18:01:33 +0000

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; } };



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 27 Nov 2012 - 18:06:12 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 28 Nov 2012 - 12:01:57 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive