[Libwebsockets] PR: improving version detection for using code

Michael Haberler mail17 at mah.priv.at
Mon Aug 11 13:19:16 CEST 2014


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


best regards

- Michael

ps: this method is used in Google protobuf and very useful for compatibility checks.





More information about the Libwebsockets mailing list