[xsd-users] segmentation fault in the simplified library example(C++/Parser)

Boris Kolpackov boris at codesynthesis.com
Mon Mar 12 06:55:25 EDT 2012


Hi Wahid,

Wahid <hamishagi at yahoo.com> writes:

> Then let the following command creat the skeleton and implementation files
> for you:
> xsd cxx-parser --generate-noop-impl --type-map library.map library.xsd

When you use a type map, generated post_*() callbacks have non-void return
types. Take a look, for example, at the generated catalog_pimpl class. The
post_catalog() callback has the following signature:

virtual library::catalog
post_catalog ();

If you look at the generated implementation for this callback, you will
see:

library::catalog catalog_pimpl::
post_catalog ()
{
  // TODO
  //
  // return ... ;
}

As you can see, the comment even tells you that you must remember to
return the value from this function!

In more general terms, the generated implementations are just stubs
that you must fill with actual code. When type maps are not used, the
generated implementations will run as is (though won't do anything
useful). If, however, you are using type maps, then you will need to
fill in the implementations to at least return something.

Boris



More information about the xsd-users mailing list