[Libwebsockets] PR: improving version detection for using code

Andy Green andy at warmcat.com
Mon Aug 11 13:28:22 CEST 2014

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 (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:
>> 1003000)
>	// 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.


>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

More information about the Libwebsockets mailing list