[Boost][serialization] link problems with MSVC.NET/no bjam
Hi,
I have struggled to get the boost libraries link into my application
with no success so far. I was able to compile most of the demo programs
with bjam, but it seems that only static linking is used there. I'm
using the dynamic versions. The libraries compiled fine with MSVC.NET
7.1. However, whenever I try to link them to an application, every
symbol seems to be undefined. I turned on the diagnostics to see that
the automatic linking is happening (with the nonstandard preprocessor
stuff). I also added the libraries to my project manually without
success. The funny (?) thing is that the lib file has a definition for
the "missing" functions, except for one minor difference. This is the
mangled symbol the linker complains about:
__imp_?save@?$xml_oarchive_impl@Vxml_oarchive@archive@boost@@@archive@boost@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z
(Omitting namespaces this one decrypts to
xml_oarchive_impl
Replying to myself... The issue is still not resolved, but I got a bit further. The slight difference in the mangled function signatures is a rather significant one. (Just found out what the undname.exe program in VC++ bin dir does.) It seems that the boost serialization library contains save/load definitions for single-byte character strings, not the wide char versions. "G" demangled seems to be "unsigned short" while "D" stands for "char". So, how do I make my application use the single-byte version of std::string? -Topi- Topi Mäenpää wrote:
Hi,
I have struggled to get the boost libraries link into my application with no success so far. I was able to compile most of the demo programs with bjam, but it seems that only static linking is used there. I'm using the dynamic versions. The libraries compiled fine with MSVC.NET 7.1. However, whenever I try to link them to an application, every symbol seems to be undefined. I turned on the diagnostics to see that the automatic linking is happening (with the nonstandard preprocessor stuff). I also added the libraries to my project manually without success. The funny (?) thing is that the lib file has a definition for the "missing" functions, except for one minor difference. This is the mangled symbol the linker complains about:
__imp_?save@?$xml_oarchive_impl@Vxml_oarchive@archive@boost@@@archive@boost@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z
(Omitting namespaces this one decrypts to xml_oarchive_impl
::save(basic_string& const)) This is what seems to be in the library:
__imp_?save@?$xml_oarchive_impl@Vxml_oarchive@archive@boost@@@archive@boost@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
The only difference is that the library symbol contains a "D" and the linker is looking for "G" in a couple of places. I have found no way of going any further. Since the demos are built in debug mode and with static libraries, I found no useful information by inspecting the commands bjam uses in building them. Everything is just like I have in my own project.
I have defined BOOST_SERIALIZATION_DYN_LINK, if you happen to think about that. I even managed to link my app with mingw, but got strange run-time errors. Everything works fine with gcc on Linux.
Any advice?
-Topi-
Topi Mäenpää wrote:
Replying to myself...
The issue is still not resolved, but I got a bit further. The slight difference in the mangled function signatures is a rather significant one. (Just found out what the undname.exe program in VC++ bin dir does.) It seems that the boost serialization library contains save/load definitions for single-byte character strings, not the wide char versions. "G" demangled seems to be "unsigned short" while "D" stands for "char". So, how do I make my application use the single-byte version of std::string?
You check the appropriate box in the project properties of the VC7IDE. There is a setting which determines whether wide characters should be considered as unsigned short or a separate type wchar_t Robert Ramey
It seems that the boost serialization library contains save/load definitions for single-byte character strings, not the wide char versions. "G" demangled seems to be "unsigned short" while "D" stands for "char". So, how do I make my application use the single-byte version of std::string?
Could this be related to the /Zc:wchar_t switch? The libraries will be built with that, how about your app? HTH, John.
From the information you've given it sounds to me that there is a mismatch somewhere between the ABI in your project and the libraries. I'm guessing your using the VC 7.1 IDE to build. If so you might look into the directory VC7IDE in libs/serialization and compare the project properties with those
We run the test suite for both the static and dll versions of the serialization library. They work the same. you could do this yourself by invokeing runtest.bat from within the libs/serialization/test directory. projects with your own. Note, that I build all the tests in release mode as well as debug mode and everything builds and executes without problem on all compilers except for borland. Robert Ramey Topi Mäenpää wrote:
Hi,
I have struggled to get the boost libraries link into my application with no success so far. I was able to compile most of the demo programs with bjam, but it seems that only static linking is used there. I'm using the dynamic versions. The libraries compiled fine with MSVC.NET 7.1. However, whenever I try to link them to an application, every symbol seems to be undefined. I turned on the diagnostics to see that the automatic linking is happening (with the nonstandard preprocessor stuff). I also added the libraries to my project manually without success. The funny (?) thing is that the lib file has a definition for the "missing" functions, except for one minor difference. This is the mangled symbol the linker complains about:
__imp_?save@?$xml_oarchive_impl@Vxml_oarchive@archive@boost@@@archive@boost@@QAEXABV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@@Z
(Omitting namespaces this one decrypts to xml_oarchive_impl
::save(basic_string& const)) This is what seems to be in the library:
__imp_?save@?$xml_oarchive_impl@Vxml_oarchive@archive@boost@@@archive@boost@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z
The only difference is that the library symbol contains a "D" and the linker is looking for "G" in a couple of places. I have found no way of going any further. Since the demos are built in debug mode and with static libraries, I found no useful information by inspecting the commands bjam uses in building them. Everything is just like I have in my own project.
I have defined BOOST_SERIALIZATION_DYN_LINK, if you happen to think about that. I even managed to link my app with mingw, but got strange run-time errors. Everything works fine with gcc on Linux.
Any advice?
-Topi-
participants (3)
-
John Maddock
-
Robert Ramey
-
Topi Mäenpää