Boost logo

Boost Users :

Subject: [Boost-users] [archive]: Problem with creating a C-Interface DLL using Serialization/Archive
From: von Arx, Martin (Martin.von-Arx_at_[hidden])
Date: 2009-02-26 08:47:41


I'm writing a DLL which uses Boost for the Serialization (version 1.36.0).
Because it has to maintain in different system I want to maintain a pure C-Interface DLL.

As soon as I use the Boost-Library by activating the two lines
      boost::archive::text_iarchive ia(is);
      ia >> foo;
in the function CNwDeSerialize_Test( )
it's C++ Interface becomes exposed in my C-Interface.

Anybody got an idea why and what I can do to prevent it ?

Regards
Martin

//=====================================================
// Modul: stdafx.h

#include <boost/archive/tmpdir.hpp>

#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>

#include <boost/serialization/base_object.hpp>
#include <boost/serialization/utility.hpp>
#include <boost/serialization/list.hpp>
#include <boost/serialization/assume_abstract.hpp>

#include <boost/shared_ptr.hpp>

//=====================================================
// Modul: ChannelNwManager.h
// ChannelNwManager.h : Defines the exported functions for the DLL application.
//

#ifdef __cplusplus
extern "C" {
#endif

#ifdef CHANNELNWMANAGER_EXPORTS
#define CHNNWMANAGER_API extern "C" __declspec(dllexport)
#else
#define CHNNWMANAGER_API extern "C" __declspec(dllimport)
#endif

CHNNWMANAGER_API void
CNwDeSerialize_Test( void );

#ifdef __cplusplus
}
#endif

//=====================================================
// Modul: ChannelNwManager.cpp

#include "stdafx.h"

extern "C" __declspec(dllexport) void
CNwDeSerialize_Test( )
{
      int foo;
      std::istringstream is("1");
// boost::archive::text_iarchive ia(is);
// ia >> foo;
}

// =====================================================
// Modul: ChannelNwManager.cpp

#include "stdafx.h"

extern "C" __declspec(dllexport) void
CNwDeSerialize_Test( )
{
      int foo;
      std::istringstream is("1");
      boost::archive::text_iarchive ia(is);
      ia >> foo;
}




Bild (Geräteunabhängige Bitmap) 1.jpg
Bild (Geräteunabhängige Bitmap) 2.jpg

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net