|
Boost Users : |
Subject: Re: [Boost-users] [archive]: Problem with creating a C-Interface DLL using Serialization/Archive
From: Robert Ramey (ramey_at_[hidden])
Date: 2009-02-26 11:05:34
Likely due to the fact that you're importing the DLL version of the library.
But is this a problem. The interface may be exposed, but no one has to call it.
Alternatively, you might build the DLL so that it uses the static version of
the library, but that might have other problematiic side effects.
Robert Ramey
"von Arx, Martin" <Martin.von-Arx_at_[hidden]> wrote in message news:8A0D9960AA14A04D864377FD63F1FE401F7F0975E2_at_SBUA0011.albis.local...
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;
}
------------------------------------------------------------------------------
------------------------------------------------------------------------------
------------------------------------------------------------------------------
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
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