xiph / vorbis

Reference implementation of the Ogg Vorbis audio format.
BSD 3-Clause "New" or "Revised" License
467 stars 188 forks source link

Add library name to def files #74

Closed MangoFizz closed 3 years ago

MangoFizz commented 3 years ago

I was getting this error when cross compiling using MinGW under Debian.

/usr/bin/x86_64-w64-mingw32-ld: ../../win32/vorbis.def:3: syntax error /usr/bin/x86_64-w64-mingw32-ld:../../win32/vorbis.def: file format not recognized; treating as linker script /usr/bin/x86_64-w64-mingw32-ld:../../win32/vorbis.def:2: syntax error collect2: error: ld returned 1 exit status

According to the Microsoft C++ Docs, the the name of the DLL must be after LIBRARY statement. https://docs.microsoft.com/en-us/cpp/build/exporting-from-a-dll-using-def-files

sezero commented 3 years ago

LIBRARY lines can actually be removed: Tested such a build under VS2017 a patch is inlined below:

diff --git a/win32/vorbis.def b/win32/vorbis.def
index 884f8f0..37c0d47 100644
--- a/win32/vorbis.def
+++ b/win32/vorbis.def
@@ -1,6 +1,6 @@
 ; vorbis.def
 ; 
-LIBRARY
+
 EXPORTS
 _floor_P
 _mapping_P
diff --git a/win32/vorbisenc.def b/win32/vorbisenc.def
index 79af064..40a3e39 100644
--- a/win32/vorbisenc.def
+++ b/win32/vorbisenc.def
@@ -1,6 +1,5 @@
 ; vorbisenc.def
 ;
-LIBRARY

 EXPORTS
 vorbis_encode_init
diff --git a/win32/vorbisfile.def b/win32/vorbisfile.def
index 4dc5549..a8a8446 100644
--- a/win32/vorbisfile.def
+++ b/win32/vorbisfile.def
@@ -1,6 +1,6 @@
 ; vorbisfile.def
 ;
-LIBRARY
+
 EXPORTS
 ov_clear
 ov_open

The LIBRARY line can be removed from ogg.def in the ogg project, too.

MangoFizz commented 3 years ago

Understood, thanks!