Re: gdlmm



> On Fri, 2005-09-16 at 13:02 +0200, Murray Cumming wrote:
>> > Small question, is the use of _new functions in constructors always a
>> > problem, or is something like _WRAP_CTOR(Dock(const Dock& original,
>> bool
>> > floating), gdl_dock_new_from) OK ?
>>
>> That's good. That just tells _WRAP_CTOR() to look at gdl_dock_new_from()
>> to see what C parameter types it takes, so it can know how to convert
>> the
>> C++ parameters to the C parameters (by looking at the .m4 conversion
>> files.). It then uses g_object_new() in the generated .cc file.
>>
>
> But it doesn't call the gdl_dock_new_from function, or does it ? If it
> doesn't it will skip some stuff that should be called;

As I hinted, you need to patch the C library so that it doesn't do extra
stuff in the _new() function. New functions should just be sugar around
g_object_new().

Or you need to hand-code the c++ constructor in your .ccg file, and do the
same stuff there. That's not always possible, because it sometimes uses
private structs and functions.

If it's too much work to make the C object do this properly, you can
patch/ask to add a public *_construct(GdlThing*) function, but that's
ugly.

[snip]
> So for the example above i have to do something like;
>
> Dock::Dock(const Dock& original, bool floating)
> : _CONSTRUCT("master", GDL_DOCK_OBJECT_GET_MASTER (original.gobj()),
> "floating", floating)
> {
> 	this->unset_flag(GDL_DOCK_AUTOMATIC);
> }

Yes. I should have this far before answering.

Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com




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