Re: [Vala] Can adding new virtual method break ABI?




Yes it does. What C programmers often do is adding unused vfuncs as 
padding for future extension of the class. From this perspective Vala 
could theoretically add some kind of padding to avoid abi breakage.
So what about this idea for fix it:
Create a new attribute property in [CCode], named binary_position, that is used for virtual methods, but can 
be used for another things(such as fields, etc.).
It can be used by the developer to avoid this risk, by doing so:
Every time the developer create a new virtual method, he shell pick the smallest number available for virtual 
method position, and put it in binary_position in [CCode].
On every planned ABI(&API) break, he can minimize those binary_position(s) for virtual methods.

This idea is based on the assumption that the size of XClass struct doesn't matter and can be changed(Am I 
right?).
Also, how does the virtual method order is currently done by Vala? Is it alphabetic or by the order of the 
decelerations?

Thanks
Tal

Date: Sun, 11 Dec 2011 10:48:21 +0100
Subject: Re: [Vala] Can adding new virtual method break ABI?
From: lethalman88 gmail com
To: tal_hd hotmail com
CC: vala-list gnome org

2011/12/11 Tal Hadad <tal_hd hotmail com>



I've read how GObject define virtual methods, in the XClass struct, and

I'm afraid defining new virtual method can break ABI. Am I right?

Before:

struct _XClass

{

GObjectClass parent_class;



/* stuff */

void (*do_action) (X *self, /* parameters */);

};



After:

struct _XClass

{



GObjectClass parent_class;





/* stuff */





void (*another_action) (X *self, /* parameters */);



void (*do_action) (X *self, /* parameters */);



};



Can this case break ABI?


 Yes it does. What C programmers often do is adding unused vfuncs as padding for future extension of the 
class. From this perspective Vala could theoretically add some kind of padding to avoid abi breakage.

-- 
www.debian.org - The Universal Operating System
                                          


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