Page 1 of 1

Using Boost Serialization

Posted: Mon Jun 23, 2014 2:14 pm
by Raider
Hello!
I'm trying to build a RCF-2.0.1.100 with using Boost.Serialization.
I've defined RCF_USE_BOOST_SERIALIZATION for all RCFDemo projects and I modified MyService.hpp like this:

Code: Select all

#ifndef INCLUDE_MYSERVICE_HPP
#define INCLUDE_MYSERVICE_HPP

#include <string>
#include <vector>
#include <boost/serialization/vector.hpp>

#include <RCF/Idl.hpp>

// ensure RCF_USE_BOOST_SERIALIZATION is used
#ifndef RCF_USE_BOOST_SERIALIZATION
#error This is a test for RCF_USE_BOOST_SERIALIZATION
#endif

RCF_BEGIN(MyService, "MyService")
    RCF_METHOD_V1(void, reverse, std::vector<std::string> &);
RCF_END(MyService);

#endif // ! INCLUDE_MYSERVICE_HPP
But I'm getting error messages in both Client and Server projects.

Code: Select all

1>c:\users\raider\desktop\rcf-2.0.1.100\include\sf\serializer.hpp(283): error C2039: 'serialize' : is not a member of 'std::vector<_Ty>'
1>          with
1>          [
1>              _Ty=std::string
1>          ]
1>          c:\users\raider\desktop\rcf-2.0.1.100\include\sf\serializer.hpp(301) : see reference to function template instantiation 'void SF::serializeInternal<T>(SF::Archive &,T &)' being compiled
1>          with
1>          [
1>              T=U
1>          ]
...
I also get an error in case I try to use my class as a parameter:

Code: Select all

struct myvector
{
	void reverse()
	{
		// todo
	}

	template <class TArchive>
	void serialize(TArchive &Archive, const unsigned int Version)
	{
		// todo
	}
};

RCF_BEGIN(MyService, "MyService")
    RCF_METHOD_V1(void, reverse, myvector &);
RCF_END(MyService);
Error log:

Code: Select all

1>c:\users\raider\desktop\rcf-2.0.1.100\include\sf\serializer.hpp(283): error C2780: 'void myvector::serialize(TArchive &,const unsigned int)' : expects 2 arguments - 1 provided
1>          c:\users\raider\desktop\rcf-2.0.1.100\demo\myservice.hpp(23) : see declaration of 'myvector::serialize'
1>          c:\users\raider\desktop\rcf-2.0.1.100\include\sf\serializer.hpp(301) : see reference to function template instantiation 'void SF::serializeInternal<T>(SF::Archive &,T &)' being compiled
1>          with
1>          [
1>              T=U
1>          ]
...
How can I disable SF usage?

PS. Compiler is Visual C++ 2010, Boost 1.55

Re: Using Boost Serialization

Posted: Wed Jun 25, 2014 11:57 am
by jarl
You can disable SF by defining RCF_FEATURE_SF=0 in your build... I will change the code so that this is done automatically when RCF_USE_BOOST_SERIALIZATION is defined.

Re: Using Boost Serialization

Posted: Thu Jun 26, 2014 11:05 am
by Raider
Thank you. It works.

PS. Just want to notice you what it was OK before (in 2.0.0.2682 and 1.3).

Re: Using Boost Serialization

Posted: Fri Jun 27, 2014 12:30 am
by jarl
Yes... There have been some recent changes to how the configuration macros are implemented, which caused this.