[vlc-commits] [Git][videolan/vlc][master] lib: add a function to the ABI version of the libraries
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Dec 7 10:43:41 UTC 2022
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
bd4b273d by Steve Lhomme at 2022-12-07T10:16:46+00:00
lib: add a function to the ABI version of the libraries
For users of libvlc with manual DLL loading (especially languages not
compatible with C that have to recode the access to the libvlc DLL) it is
important to know the ABI version of the DLL, in case of API/ABI changes the
wrapper need to be updated and know when the provided DLL package matches or
not. This is especially critical for VLC 4.0 which has not changed version in
4 years and yet the libvlc API keeps changing.
This is similar to the versions of libavcodec/libavformat/etc. When the API is
changed the version values should be updated as well, and hopefully documented
as well.
One should avoid loading the DLL of a mismatching libvlc major ABI version.
Since it's likely to not be usable in the end, it's better not to load it at
all.
This should also be backported to VLC 3.0.
- - - - -
3 changed files:
- include/vlc/libvlc.h
- lib/core.c
- lib/libvlc.sym
Changes:
=====================================
include/vlc/libvlc.h
=====================================
@@ -184,6 +184,23 @@ LIBVLC_API void libvlc_release( libvlc_instance_t *p_instance );
*/
LIBVLC_API void libvlc_retain( libvlc_instance_t *p_instance );
+/**
+ * Get the ABI version of the libvlc library.
+ *
+ * This is different than the VLC version, which is the version of the whole
+ * VLC package. The value is the same as LIBVLC_ABI_VERSION_INT used when
+ * compiling.
+ *
+ * \return a value with the following mask in hexadecimal
+ * 0xFF000000: major VLC version, similar to VLC major version,
+ * 0x00FF0000: major ABI version, incremented incompatible changes are added,
+ * 0x0000FF00: minor ABI version, incremented when new functions are added
+ * 0x000000FF: micro ABI version, incremented with new release/builds
+ *
+ * \note This the same value as the .so version but cross platform.
+ */
+LIBVLC_API int libvlc_abi_version(void);
+
/**
* Try to start a user interface for the libvlc instance.
*
=====================================
lib/core.c
=====================================
@@ -34,6 +34,10 @@
#include <limits.h>
#include <assert.h>
+int libvlc_abi_version(void)
+{
+ return LIBVLC_ABI_VERSION_INT;
+}
libvlc_instance_t * libvlc_new( int argc, const char *const *argv )
{
=====================================
lib/libvlc.sym
=====================================
@@ -290,3 +290,4 @@ libvlc_picture_get_time
libvlc_picture_list_at
libvlc_picture_list_count
libvlc_picture_list_destroy
+libvlc_abi_version
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/bd4b273d077b3a283a57b4b23e1fd12097c96d71
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/bd4b273d077b3a283a57b4b23e1fd12097c96d71
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list