Opened 12 years ago

Closed 12 years ago

#5371 closed Feature Requests (wontfix)

The portable binary example fails to compile when the BOOST_ALL_DYN_LINK macro is defined.

Reported by: benedikt.huber@… Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.45.0 Severity: Not Applicable
Keywords: Cc:

Description

Dears,

The portable binary example demo_portable_archive.cpp fails to compile when the BOOST_ALL_DYN_LINK macro is defined. With boolst 1.45 under windows 7 in Visual Studio 2008 the compiler stops with error C2491 (definition of dllimport function not allowed).

Compilation works when I globally define BOOST_ARCHIVE_SOURCE. However I suppose this private macro is not intended to be globally defined in the command line. Furthermore this breaks Visual Studio's autolink feature so that I have to explicitly add boost_serialization-vc90-mt.lib to the linker dependencies.

The problem seems to be connected to BOOST_ARCHIVE_OR_WARCHIVE_DECL. How can this issue be fixed so that we can write custom binary archives and use BOOST_ALL_DYN_LINK?

To make the example_project compile in you environment you first have to set the library and include directories according to you boost root. (AdditionalLibraryDirectories AdditionalIncludeDirectories in the project file.) The exe is put to example_project\debug\output. A file containing the error message is also in example_project.

Best regards, Benedikt Huber

Attachments (1)

example_project.zip (11.5 KB ) - added by benedikt.huber@… 12 years ago.
Project that fails to compile.

Download all attachments as: .zip

Change History (3)

by benedikt.huber@…, 12 years ago

Attachment: example_project.zip added

Project that fails to compile.

comment:1 by anonymous, 12 years ago

Component: Noneserialization
Owner: set to Robert Ramey

comment:2 by Robert Ramey, 12 years ago

Resolution: wontfix
Severity: ProblemNot Applicable
Status: newclosed
Type: BugsFeature Requests

demo_portable_archive.cpp is an example. The example as written does work as advertised.

If you want to turn it into a "full fledged" archive class like the other "official" ones, you could add in the autolinking macros in a way similar to the way they are used in the other archives. If you want to do this and test it I would consider checking your enhancement into the trunk. But perosnally I'm too busy to deal with it now.

Robert Ramey

Note: See TracTickets for help on using tickets.