From florian.burkart at gmail.com  Tue Nov 27 19:01:33 2012
From: florian.burkart at gmail.com (Florian Burkart)
Date: Tue, 27 Nov 2012 18:01:33 +0000
Subject: [Rd] Problems with MinGW and boost on Windows
In-Reply-To: <CAPSN_LWkjENv1Y4dSxG-73yGhTfYuewScwgKKEeUjbWp97jDfw@mail.gmail.com>
References: <CAPSN_LWkjENv1Y4dSxG-73yGhTfYuewScwgKKEeUjbWp97jDfw@mail.gmail.com>
Message-ID: <CAPSN_LVtBXwWFC4xpttJ93x=J9n2WXftC-8Bi2SdAnbA7B-uQw@mail.gmail.com>

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



[Rd] Problems with MinGW and boost on Windows
Florian Burkart