[vlc-commits] [Git][videolan/vlc][master] 3 commits: separate defines to export DLL functions
    Steve Lhomme (@robUx4) 
    gitlab at videolan.org
       
    Thu Jan 12 15:09:48 UTC 2023
    
    
  
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
c952eb4e by Steve Lhomme at 2023-01-12T14:50:21+00:00
separate defines to export DLL functions
libvlc cannot have the VLC DLL export define set.
- - - - -
95b8f649 by Steve Lhomme at 2023-01-12T14:50:21+00:00
automake: define DLL export values
This is the proper way to export functions, regardless of our custom symbols
export file. This ensures the API definition in the headers match what happens
to the functions.
- - - - -
06dbdffa by Steve Lhomme at 2023-01-12T14:50:21+00:00
meson: define DLL export values
- - - - -
6 changed files:
- include/vlc/libvlc.h
- include/vlc_common.h
- lib/Makefile.am
- lib/meson.build
- src/Makefile.am
- src/meson.build
Changes:
=====================================
include/vlc/libvlc.h
=====================================
@@ -34,7 +34,7 @@
 #ifndef VLC_LIBVLC_H
 #define VLC_LIBVLC_H 1
 
-#if defined (_WIN32) && defined (DLL_EXPORT)
+#if defined (_WIN32) && defined (LIBVLC_DLL_EXPORT)
 # define LIBVLC_API __declspec(dllexport)
 #elif defined (__GNUC__) && (__GNUC__ >= 4)
 # define LIBVLC_API __attribute__((visibility("default")))
=====================================
include/vlc_common.h
=====================================
@@ -319,7 +319,7 @@
 # define VLC_EXTERN
 #endif
 
-#if defined (_WIN32) && defined (DLL_EXPORT)
+#if defined (_WIN32) && defined (VLC_DLL_EXPORT)
 # define VLC_EXPORT __declspec(dllexport)
 #elif defined (__GNUC__)
 # define VLC_EXPORT __attribute__((visibility("default")))
=====================================
lib/Makefile.am
=====================================
@@ -68,9 +68,13 @@ libvlc_la_LDFLAGS = \
 	-version-number @LIBVLC_ABI_MAJOR@:@LIBVLC_ABI_MINOR@:@LIBVLC_ABI_MICRO@ \
 	-export-symbols $(srcdir)/libvlc.sym
 libvlc_la_DEPENDENCIES = libvlc.sym
+libvlc_la_CPPFLAGS = $(AM_CPPFLAGS)
 if HAVE_WIN32
 libvlc_la_DEPENDENCIES += libvlc_win32_rc.$(OBJEXT)
 libvlc_la_LDFLAGS += -Wl,libvlc_win32_rc.$(OBJEXT) -avoid-version -Wc,-static
+if HAVE_DYNAMIC_PLUGINS
+libvlc_la_CPPFLAGS += -DLIBVLC_DLL_EXPORT
+endif
 endif
 if HAVE_OS2
 libvlc_la_LDFLAGS += -avoid-version
=====================================
lib/meson.build
=====================================
@@ -18,9 +18,15 @@ libvlc_sources = [
     'picture.c'
 ]
 
+libvlc_cargs = []
+if host_system == 'windows'
+    libvlc_cargs += ['-DLIBVLC_DLL_EXPORT']
+endif
+
 libvlc = library('vlc',
     libvlc_sources, rev_target,
     include_directories: [vlc_include_dirs],
+    c_args: libvlc_cargs,
     link_with: [vlc_libcompat],
     dependencies: [libvlccore_dep, m_lib, threads_dep],
     install: true
=====================================
src/Makefile.am
=====================================
@@ -194,6 +194,9 @@ AM_CPPFLAGS = $(INCICONV) $(IDN_CFLAGS) \
 AM_CFLAGS = $(CFLAGS_libvlccore)
 if HAVE_DYNAMIC_PLUGINS
 AM_CPPFLAGS += -DHAVE_DYNAMIC_PLUGINS
+if HAVE_WIN32
+AM_CPPFLAGS += -DVLC_DLL_EXPORT
+endif
 endif
 if HAVE_DBUS
 AM_CPPFLAGS += -DHAVE_DBUS
=====================================
src/meson.build
=====================================
@@ -35,6 +35,8 @@ libvlccore_deps = [
     m_lib, dl_lib, threads_dep, intl_dep, socket_libs, iconv_dep, anl_lib, idn_dep
 ]
 
+vlccore_cargs = [ '-DMODULE_STRING="core"', '-DHAVE_DYNAMIC_PLUGINS' ]
+
 if host_system == 'darwin'
     libvlccore_deps += foundation_dep
     libvlccore_deps += corefoundation_dep
@@ -43,6 +45,7 @@ elif host_system == 'windows'
     libvlccore_deps += cc.find_library('bcrypt')
     libvlccore_deps += cc.find_library('winmm')
     libvlccore_deps += cc.find_library('normaliz')
+    vlccore_cargs += ['-DVLC_DLL_EXPORT']
 endif
 
 #
@@ -338,7 +341,7 @@ libvlccore = library(
     libvlccore_sources, vlc_about, fourcc, rev_target,
     include_directories: vlc_include_dirs,
     version: '9.0.0',
-    c_args: ['-DMODULE_STRING="core"', '-DHAVE_DYNAMIC_PLUGINS' ],
+    c_args: vlccore_cargs,
     link_args: libvlccore_link_args,
     link_with: [vlc_libcompat],
     dependencies: libvlccore_deps,
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9ace50899bda9f4a2faf7dc01e7e9c067c874572...06dbdffa96e95e6e019f1e1c6a3a70f61cdecad5
-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/9ace50899bda9f4a2faf7dc01e7e9c067c874572...06dbdffa96e95e6e019f1e1c6a3a70f61cdecad5
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