How do you handle backwards compatibility?

Asked by Florian Forster

Hi,

I'm having a couple of changes here that require modification of the "modbus_param_t" structure. Since the struct is visible to other programs, such a change is both API and ABI incompatible. I notice, however, that the struct has been changed between 2.0.3 and the current development version.

Would you accept a patch that turns the structure into an "opaque" data type? This means that the structure will be declared in the header file but defined in "src/modbus.c". Client programs can then only use pointers to such structures but cannot dereference the pointer, effectively hiding the content of the struct.

Regards,
—octo

Question information

Language:
English Edit question
Status:
Solved
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Solved by:
Stéphane Raimbault
Solved:
Last query:
Last reply:
Revision history for this message
Best Stéphane Raimbault (sra) said :
#1

Yes, I think it's a good way to avoid bad using of the structure.

I'm annoyed to change the API so much (I've other changes on going), some libs like clutter are able to help the devs at compilation time to inform about deprecated functions, it's may be a path to follow too.

I'm not fully happy with the new API (no more SLAVE), I hope I won't annoy libmodbus users.

You seems to follow the code on bzr and git, I intend to delete the bzr repos or mark them as obsolete, now I use git.

Revision history for this message
Florian Forster (octo) said :
#2

I have to admit I'm one of the annoyed users ;) I don't really care whether I have to specify the slave each time or use a separate function for that, but the fact that I have to change my code is annoying. I've now changed my code to use the 1.2.* API until a 2.* API stabilizes. Since I plan to support both APIs eventually, I need to be able to determine the library version at compile time. I *could* use configure checks for this, but I'd prefer not to.

I welcome the switch to Git since I'm feeling more at home with it. I just didn't know how "official" the repository on Github was. I'll clone your repository there and push my future changes there.

Regards,
—octo

Revision history for this message
Florian Forster (octo) said :
#3

Thanks Stéphane Raimbault, that solved my question.