maelh / hxd-plugin-framework

Plugin framework for HxD's data inspector
Mozilla Public License 2.0
166 stars 22 forks source link

CreateConverter flags out parameter for future expansion #2

Closed sredna closed 2 years ago

sredna commented 2 years ago

This converts the DataInspector SupportsStrToBytes output parameter to a flags parameter for future expansion.

This slightly breaks ABI if somebody had code that does *SupportsStrToBytes = 2 instead of true/false but this is a non-issue since the current plug-in API is already ABI incompatible with the current HxD release (2.5.0.0).

sredna commented 2 years ago

My point was not to lock down the ABI forever but in this case it is basically a free change. Exchange one BOOL for 32 flag bits that allows future expansion without breaking ABI.

Versioning should be introduced though, to remind people of updating the interfaces, by requiring to pick the right ABI version, which will be checked upon loading the plugin.

This will add a lot of extra pain for yourself.

Another option is to use cdecl instead of stdcall, that way you can append new parameters without breaking anything.

maelh commented 2 years ago

Another option is to use cdecl instead of stdcall, that way you can append new parameters without breaking anything. I'd still want the plugin authors to be aware of the new options/changed flags, so they are taken into account in the conversion, so a type error of some kind is desirable.

From the pure ABI side, you are right, it would just work. But I want it to fail explicitly, even if I was to implement a kind of Flags solution (for example using set in Delphi which are strongly typed, which would directly map to bit fields in C).

So the solution would need a bit more work, but thanks for the suggestion, I'll consider it in a possibly modified form.