[vlc-commits] activex: Export plugin entry points via dllexport instead of a def file for mingw
Martin Storsjö
git at videolan.org
Sat Mar 17 23:46:48 CET 2018
npapi-vlc | branch: master | Martin Storsjö <martin at martin.st> | Sun Mar 18 00:46:31 2018 +0200| [d7c8dab25f1ffaee2e3cd14b140efe531c6181c3] | committer: Martin Storsjö
activex: Export plugin entry points via dllexport instead of a def file for mingw
This is the same approach as used for the npapi plugin. This
approach (using -Wl,--kill-at) is implemented in lld, while
a def file with renamed symbols isn't.
> https://code.videolan.org/videolan/npapi-vlc/commit/d7c8dab25f1ffaee2e3cd14b140efe531c6181c3
---
activex/Makefile.am | 5 ++---
activex/axvlc.def | 7 -------
activex/main.cpp | 13 ++++++++-----
3 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/activex/Makefile.am b/activex/Makefile.am
index 9b92507..d358b23 100644
--- a/activex/Makefile.am
+++ b/activex/Makefile.am
@@ -14,7 +14,6 @@ DIST_rsrc = \
DIST_misc = \
axvlc.inf.in \
- axvlc.def \
axvlc.dll.manifest \
axvlc.idl \
axvlc.tlb \
@@ -68,8 +67,8 @@ axvlc_la_SOURCES = \
axvlc_idl.c \
axvlc_idl.h
-axvlc_la_DEPENDENCIES = $(srcdir)/axvlc.def $(DATA_axvlc_rc)
-axvlc_la_LDFLAGS = -Wl,$(srcdir)/axvlc.def -Wl,$(DATA_axvlc_rc) \
+axvlc_la_DEPENDENCIES = $(DATA_axvlc_rc)
+axvlc_la_LDFLAGS = -Wl,--kill-at -Wl,$(DATA_axvlc_rc) \
-no-undefined -avoid-version -module \
-Wc,--static -Wc,-static-libgcc
axvlc_la_LIBADD = ../common/libvlcplugin_common.la \
diff --git a/activex/axvlc.def b/activex/axvlc.def
deleted file mode 100644
index 87e32f9..0000000
--- a/activex/axvlc.def
+++ /dev/null
@@ -1,7 +0,0 @@
-LIBRARY AXVLC.DLL
-EXPORTS
- DllMain = DllMain at 12
- DllCanUnloadNow = DllCanUnloadNow at 0
- DllGetClassObject = DllGetClassObject at 12
- DllRegisterServer = DllRegisterServer at 0
- DllUnregisterServer = DllUnregisterServer at 0
diff --git a/activex/main.cpp b/activex/main.cpp
index a5d925f..2b2e1e5 100644
--- a/activex/main.cpp
+++ b/activex/main.cpp
@@ -49,6 +49,9 @@ DEFINE_GUID(CATID_SafeForInitializing, \
DEFINE_GUID(CATID_SafeForScripting, \
0x7DD95801, 0x9882, 0x11CF, 0x9F, 0xA9, 0x00,0xAA,0x00,0x6C,0x42,0xC4);
# endif /* __MINGW32_MAJOR_VERSION && !__MINGW64_VERSION_MAJOR */
+# define EXPORT __declspec(dllexport)
+#else
+# define EXPORT
#endif /* __MINGW32__ */
using namespace std;
@@ -70,7 +73,7 @@ HMODULE DllGetModule()
return h_instance;
};
-STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
+STDAPI EXPORT DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
HRESULT hr = CLASS_E_CLASSNOTAVAILABLE;
@@ -86,7 +89,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return hr;
};
-STDAPI DllCanUnloadNow(VOID)
+STDAPI EXPORT DllCanUnloadNow(VOID)
{
return (0 == i_class_ref) ? S_OK: S_FALSE;
};
@@ -157,7 +160,7 @@ static void UnregisterProgID(REFCLSID rclsid, unsigned int version)
}
};
-STDAPI DllUnregisterServer(VOID)
+STDAPI EXPORT DllUnregisterServer(VOID)
{
// unregister type lib from the registry
#if !defined(_WIN64)
@@ -336,7 +339,7 @@ static HRESULT RegisterClassID(HKEY hParent, REFCLSID rclsid, unsigned int versi
return S_OK;
}
-STDAPI DllRegisterServer(VOID)
+STDAPI EXPORT DllRegisterServer(VOID)
{
DllUnregisterServer();
@@ -474,7 +477,7 @@ STDAPI_(int) WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
#else
-STDAPI_(BOOL) DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved )
+STDAPI_(BOOL) EXPORT DllMain(HANDLE hModule, DWORD fdwReason, LPVOID lpReserved )
{
(void)lpReserved;
switch( fdwReason )
More information about the vlc-commits
mailing list