#include
#include #include "cmdef.h"
namespace boost { namespace serialization {
template<class Archive> void serialize(Archive & ar, struct NODE_MGR & st, const unsigned int version) { ar & st.ApplName; // line 19 in err msg ar & st.CompName; // line 20 in err msg }
} // end namespace serialization */ } // end of namespace boost */
--------------------
/* arch.cpp */
#include <sstream>
#include "arch.hpp"
int main() { const struct NODE_MGR nm; // this will fix errors in second case - see rationale std::ostringstream ofs; boost::archive::text_oarchive oa(ofs);
oa << nm; // line 15 in err msg
return 0; }
Compiling arch.cpp produces these errors:
arch.hpp:19: error: cannot bind packed field st->NODE_MGR::ApplName to char (&)[8]
arch.hpp:20: error: cannot bind packed field st->NODE_MGR::CompName to char (&)[8]
However, on the workstation side the structs MUST remain 'packed'; otherwise thousands of source files will have to be modified.
Is there any way to make this work with boost archives, or should I explore other options?
I don't see how this could be addressed from within the serialization library. It looks like anthing that looks like ostream os; os << nm; is going to fail as well. I suspect that your strategy is going to be foiled whether you use the serialization or some other method. Robert Ramey