[Libwebsockets] PR: improving version detection for using code
andy at warmcat.com
Mon Aug 11 14:28:10 CEST 2014
On 11 August 2014 20:03:25 GMT+08:00, Michael Haberler <mail17 at mah.priv.at> wrote:
>Am 11.08.2014 um 13:28 schrieb Andy Green <andy at warmcat.com>:
>> On 11 August 2014 19:19:16 GMT+08:00, Michael Haberler
><mail17 at mah.priv.at> wrote:
>>> thanks! I verified your id field fix takes care of my protocol
>>> names/options issue.
>>> However I have to switch to bleeding edge git and use unreleased
>>> features; testing for this is a bit rough to do in the current code
>>> I added an easy method for library version number comparison
>>> time), so I can make the using code conditional on the API version:
>>> this suggests to increase (at least) the micro number in
>>> for each API change.
>>> Using code can then use new API features like so:
>>> #if defined(LWS_LIBRARY_VERSION_NUMBER) &&
>>> // use feature introduced post 1.3.0
>> I think that's a good idea, but when this came up before instead of a
>version number I used per-feature defines. That way you test what
>you're really interested in, the feature, without having the care or
>associate it to version numbers.
>> If you add an LWS_FEATURE_... define here instead
>> I'll be very happy to take the patch.
>did you mean just the LWS_FEATURE* define or both?
Just the define.
>not sure if features alone cut it; at some point you'd want to require
>a minimum base version and doing that through testing for a series of
>features is possible but a tad odd
At which point in the history of lws all the features you need are present is actually decided by which features you're using though.
If you don't use any features that only came later, you are de facto compatible with builds from older sources.
And this works without a version ordinal inbetween releases and in the case features are removed.
>you call the shots ;)
>>> best regards
>>> - Michael
>>> ps: this method is used in Google protobuf and very useful for
>>> compatibility checks.
>>> Libwebsockets mailing list
>>> Libwebsockets at ml.libwebsockets.org
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
More information about the Libwebsockets