Ok well in trying to get the serialization library working on my environment, I am having trouble loading user types via pointer.  I've simplifed the class in question down to a struct containing PODs.   Changing the trivial example to save and load via a local stack variable ( i.e. ar & pass-by-reference) does work, however the real program I am trying to save a graph of structures foo with pointers to bar, I'm back to the original link error when trying to load the graph back, even when the root type passed into serialize is a reference type.



My environment is WinXP w/ msvc8sp1  (aka visual studio 2005 sp1), and boost 1.34


pseudoprogram:


#include <iostream>
#include <fstream>
#include "boost/serialization/access.hpp"
#include "boost/archive/text_iarchive.hpp"
#include "boost/archive/text_oarchive.hpp"

struct MyVector3
{
    float X;
    float Y;
    float Z;

    MyVector3()
    {}
    MyVector3(float x, float y, float z)
        : X(x), Y(y), Z(z)
    {}
};

template<class Archive>
void serialize(Archive & ar, MyVector3& v, const unsigned int version)
{
    ar & v.X;
    ar & v.Y;
    ar & v.Z;
}

int main(int argc, const char** argv)
{
    // Saving via pointer works ---
    std::string filename("TestVector.raw");
    MyVector3* WriteVector = new MyVector3(1.1f, 2.2f, 3.3f);
    std::ofstream ofs(filename.c_str());
    boost::archive::text_oarchive oa(ofs);
    oa & WriteVector;
    ofs.close();

    // Loading via pointer does not ---
    MyVector3* ReadVector = NULL;
    std::ifstream ifs(filename.c_str());
    boost::archive::text_iarchive ia(ifs);
    ia & ReadVector;  // <--- commenting this line out makes the link error go away, but then you can't load anything
    ifs.close();
}




Link error is

error LNK2019: unresolved external symbol "public: class boost::archive::detail::basic_pointer_iserializer const * __thiscall boost::archive::detail::basic_iarchive::load_pointer(void * &,class boost::archive::detail::basic_pointer_iserializer const *,class boost::archive::detail::basic_pointer_iserializer const * (__fastcall*)(class boost::serialization::extended_type_info const &))" (?load_pointer@ basic_iarchive@detail@archive@boost@@QAEPBVbasic_pointer_iserializer@234@AAPAXPBV5234@P6IPBV5234@ABVextended_type_info@serialization@4@@Z@Z) referenced in function "public: static void __fastcall boost::archive::detail::load_pointer_type<class boost::archive::text_iarchive,struct MyVector3 *>::invoke(class boost::archive::text_iarchive &,struct MyVector3 * &)" (?invoke@?$load_pointer_type@ Vtext_iarchive@archive@boost@@PAUMyVector3@@@detail@archive@boost@@SIXAAVtext_iarchive@34@AAPAUMyVector3@@@Z)

error LNK2019: unresolved external symbol "public: static class boost::archive::detail::basic_pointer_iserializer const * __fastcall boost::archive::detail::archive_pointer_iserializer<class boost::archive::text_iarchive>::find(class boost::serialization::extended_type_info const &)" (?find@?$archive_pointer_iserializer@ Vtext_iarchive@archive@boost@@@detail@archive@boost@@SIPBVbasic_pointer_iserializer@234@ABVextended_type_info@serialization@4@@Z) referenced in function "public: static void __fastcall boost::archive::detail::load_pointer_type<class boost::archive::text_iarchive,struct MyVector3 *>::invoke(class boost::archive::text_iarchive &,struct MyVector3 * &)" (?invoke@?$load_pointer_type@ Vtext_iarchive@archive@boost@@PAUMyVector3@@@detail@archive@boost@@SIXAAVtext_iarchive@34@AAPAUMyVector3@@@Z)

error LNK2019: unresolved external symbol "void const * __fastcall boost::serialization::void_upcast(class boost::serialization::extended_type_info const &,class boost::serialization::extended_type_info const &,void const * const,bool)" (?void_upcast@ serialization@boost@@YIPBXABVextended_type_info@12@0QBX_N@Z) referenced in function "void * __fastcall boost::serialization::void_upcast(class boost::serialization::extended_type_info const &,class boost::serialization::extended_type_info const &,void * const)" (?void_upcast@ serialization@boost@@YIPAXABVextended_type_info@12@0QAX@Z)