[Libwebsockets] PR: improving version detection for using code
mail17 at mah.priv.at
Mon Aug 11 14:03:25 CEST 2014
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 (compile
>> time), so I can make the using code conditional on the API version:
>> 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
>> // 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?
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
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
More information about the Libwebsockets