Re: STL and Glibmm



Hi,

indeed, the piece of API I'm refering to is an abstract class that the end-user might use to create a custom parser. It's probable that nobody ever tried.

The other uses of std::map in Glibmm are CppOptionEntry, which I don't known what it does and a template class Variant. As it is a template, the implementation is available to the end user's compiler and it would only crash if an object of this type were returned by a function in Glibmm.

These 3 classes potentially don't work on Visual Studio. Since I don't really understand what their use is, I cannot test them, sorry for not being more useful.

Thanks,
yann

On 09/04/2014 12:46, Murray Cumming wrote:
On Tue, 2014-04-08 at 17:39 +0200, Yann Leydier wrote:
Hi,

when I first saw that Gtkmm was using wrappers to handle conversions to
STL containers, I thought that it was expected, because Visual C++'s STL
implementation is not fully compatible with the DLL import/export system.

Up to now, I was using STLport to enable the use of STL in my DLLs (thus
I had to recompile Gtkmm with STLport…) and I'm currently looking for
another solution. I tried to look at how Glibmm does it and I'm quite
confused.

It should be OK to work with vectors, provided you export the right
symbols. I suppose gendef does this, but it's difficult to check since
the symbols are mangled.

According to MSDN, it should be totally impossible to use maps in the
API, however in markup.h (version 2.28.2), there is a typedef on a map:
typedef std::map<Glib::ustring, Glib::ustring,
Glib::Markup::AttributeKeyLess> AttributeMap;
This type is then used in a method of the class Parser:
virtual void on_start_element(ParseContext& context,
const Glib::ustring& element_name,
const AttributeMap& attributes);

This is the same as passing a reference to a map from the main program
to the DLL, which should cause an undefined behaviour (in my past
experience it always caused a crash).

Is it a bug? If not, does someone know why/how it works?

Maybe that particular API has never been used on Windows?




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]