After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 570620 - Using LibXML++ under MSVC gives many warnings
Using LibXML++ under MSVC gives many warnings
Status: RESOLVED FIXED
Product: libxml++
Classification: Bindings
Component: Build
2.6.x
Other All
: Normal minor
: ---
Assigned To: Christophe de Vienne
Christophe de Vienne
Depends on:
Blocks:
 
 
Reported: 2009-02-05 12:43 UTC by Arjan Franzen
Modified: 2020-11-11 09:06 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Arjan Franzen 2009-02-05 12:43:30 UTC
Please describe the problem:
When you use the LibXML++ bindings with the Microsoft Visual C++ Compiler (version 8.0 and 9.0) you get the following warning

:\Program Files\gtkmm\include\libxml++-2.6\libxml++/exceptions/exception.h(46): warning C4251: 'xmlpp::exception::message_' : class 'Glib::ustring' needs to have dll-interface to be used by clients of class 'xmlpp::exception'



Steps to reproduce:
1. Compile any project using LibXML++ and Visual Studio 2005/2008


Actual results:
The following warning occurs on every include of libxml++

:\Program Files\gtkmm\include\libxml++-2.6\libxml++/exceptions/exception.h(46): warning C4251: 'xmlpp::exception::message_' : class 'Glib::ustring' needs to have dll-interface to be used by clients of class 'xmlpp::exception'

Expected results:
No warning

Does this happen every time?
Yes

Other information:
I've fixed the warning as follows:

add the following forward declaration to libxml++\exceptions\exception.h 

class GLIBMM_API Glib::ustring;
Comment 1 Murray Cumming 2010-05-04 15:28:28 UTC
Should the change be made in glibmm? If so, please provide a patch for glibmm.
Comment 2 Murray Cumming 2010-06-14 07:41:31 UTC
CCing Armin in case he has ideas.
Comment 3 Armin Burgmeier 2010-06-14 17:40:57 UTC
I think the warning is because xmlpp::exception is declared with LIBXMLPP_API (which is __declspec(dllimport)) but Glib::ustring is not. I have never completely understood why these specifications are actually needed since most things seem to work well without; most things in glibmm and gtkmm do not use them. However I see that Cedric added this in 2006, and he probably had good reasons in doing so.

So I think the way to go about that is to add GLIBMM_API to Glib::ustring in glibmm.
Comment 4 Murray Cumming 2010-10-19 09:21:16 UTC
> So I think the way to go about that is to add GLIBMM_API to Glib::ustring in
> glibmm.

Well, feel free to do that, I guess.
Comment 5 Murray Cumming 2010-11-18 08:38:34 UTC
Arjan, a patch would be welcome.
Comment 6 Kjell Ahlstedt 2020-11-11 09:06:56 UTC
libxmlplusplus (a.k.a. libxml++) can now be built with MS Visual Studio.
See the MSVC_NMake/README file. Different versions of libxml++ require different
versions of MSVC, Visual Studio 2015 (MSVC 14.0) or later for libxml++-2,
Visual Studio 2017 (MSVC 16.0) or later for libxml++-3.

libxml++ is now stored at GitHub,
https://github.com/libxmlplusplus/libxmlplusplus