[Libwebsockets] PR: improving version detection for using code

Andy Green 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:
>>> Andy,
>>> 
>>> 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
>(compile
>>> time), so I can make the using code conditional on the API version:
>>> 
>>> https://github.com/warmcat/libwebsockets/pull/159
>>> 
>>> this suggests to increase (at least) the micro number in
>CMakeLists.txt
>>> for each API change.
>>> 
>>> Using code can then use new API features like so:
>>> 
>>> #if defined(LWS_LIBRARY_VERSION_NUMBER) &&
>(LWS_LIBRARY_VERSION_NUMBER
>>>> 1003000)
>>> 	// use feature introduced post 1.3.0
>>> #endif
>> 
>> 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
>> 
>>
>http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/tree/lib/libwebsockets.h#n144
>> 
>> 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.

-Andy

>you call the shots ;)
>
>
>- Michael
>
>
>> 
>> -Andy
>> 
>>> 
>>> 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
>>> http://ml.libwebsockets.org/mailman/listinfo/libwebsockets
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list