Re: [flac-dev] os/2 support using Watcom
On 1/24/17, Dave Yeowrote: > On 01/23/17 01:01 AM, Erik de Castro Lopo wrote: >> Dave Yeo wrote: >> >>> >GCC supports __declspec(dllexport) though it still needs a def file, >>> >with no exports. Libtool doesn't currently and as flac uses libtool... >> So you're happy with this patch? >> >> http://lists.xiph.org/pipermail/flac-dev/2017-January/006170.html >> > > No. Lots of errors such as > ../../include/FLAC/export.h:77:18: error: expected identifier or '(' before > ')' token > #define FLAC_API __declspec(__cdecl) > ... > as GCC doesn't like the __cdecl macro. Well, you were the one who suggested __declspec(__cdecl) (history for Eric: my original patch in the first mail in this thread didn't have __cdecl, Dave wanted watcom and emx-gcc built binaries to be compatible, so I suggested the second version.) However, I see what's going on: gcc is possibly expecting the calling convention specifier attribute between the type and the funcname. (which can be fixed but in a way intrusive to all the headers, such as by inventing and using a FLAC_CALL macro..) > > If going this route then perhaps, > > diff --git a/include/FLAC/export.h b/include/FLAC/export.h > index d52f0bb..5d40421 100644 > --- a/include/FLAC/export.h > +++ b/include/FLAC/export.h > @@ -66,6 +66,13 @@ > #define FLAC_API __declspec(dllimport) > #endif > > +#elif defined(__OS2__) > +#if defined(FLAC_API_EXPORTS) && defined(__WATCOMC__) && defined(__SW_BD) > +#define FLAC_API __declspec(__cdecl) __declspec(dllexport) > +#else > +#define FLAC_API __declspec(dllexport) You had said that dllexport alone is not OK with emx-gcc, and besides dllexport at that place is wrong: you want dllexport when building flac as a dll (__SW_BD from Watcom tells us that and we are sure because we defined FLAC_API_EXPORTS ourself.) That line must either be calling convention (which you reported fails with gcc) or it should be an empty define. One solution is making that line an empty define for gcc and __cdecl for Watcom. > +#endif > + > #elif defined(FLAC__USE_VISIBILITY_ATTR) > #define FLAC_API __attribute__ ((visibility ("default"))) > > Another option is for the caller to define FLAC_API, eg > #define FLAC_API __declspec(__cdecl) > #include > > diff --git a/include/FLAC/export.h b/include/FLAC/export.h > index d52f0bb..07cfe59 100644 > --- a/include/FLAC/export.h > +++ b/include/FLAC/export.h > @@ -56,6 +56,7 @@ > * \{ > */ > > +#ifndef FLAC_API > #if defined(FLAC__NO_DLL) > #define FLAC_API > > @@ -66,6 +67,10 @@ > #define FLAC_API __declspec(dllimport) > #endif > > +#elif defined(__OS2__) > +#define FLAC_API __declspec(dllexport) > +#endif > + > #elif defined(FLAC__USE_VISIBILITY_ATTR) > #define FLAC_API __attribute__ ((visibility ("default"))) > > @@ -73,7 +78,7 @@ > #define FLAC_API > > #endif > - > +#endif > /** These #defines will mirror the libtool-based library version number, > see > * > http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning > */ > > This assumes that Ozkan isn't pursuing his OpenWatcom patches which isn't > clear. Well I'm bored. You guys decide. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
On 01/23/17 01:01 AM, Erik de Castro Lopo wrote: > Dave Yeo wrote: > >> >GCC supports __declspec(dllexport) though it still needs a def file, >> >with no exports. Libtool doesn't currently and as flac uses libtool... > So you're happy with this patch? > > http://lists.xiph.org/pipermail/flac-dev/2017-January/006170.html > No. Lots of errors such as ../../include/FLAC/export.h:77:18: error: expected identifier or '(' before ')' token #define FLAC_API __declspec(__cdecl) ... as GCC doesn't like the __cdecl macro. If going this route then perhaps, diff --git a/include/FLAC/export.h b/include/FLAC/export.h index d52f0bb..5d40421 100644 --- a/include/FLAC/export.h +++ b/include/FLAC/export.h @@ -66,6 +66,13 @@ #define FLAC_API __declspec(dllimport) #endif +#elif defined(__OS2__) +#if defined(FLAC_API_EXPORTS) && defined(__WATCOMC__) && defined(__SW_BD) +#define FLAC_API __declspec(__cdecl) __declspec(dllexport) +#else +#define FLAC_API __declspec(dllexport) +#endif + #elif defined(FLAC__USE_VISIBILITY_ATTR) #define FLAC_API __attribute__ ((visibility ("default"))) Another option is for the caller to define FLAC_API, eg #define FLAC_API __declspec(__cdecl) #includediff --git a/include/FLAC/export.h b/include/FLAC/export.h index d52f0bb..07cfe59 100644 --- a/include/FLAC/export.h +++ b/include/FLAC/export.h @@ -56,6 +56,7 @@ * \{ */ +#ifndef FLAC_API #if defined(FLAC__NO_DLL) #define FLAC_API @@ -66,6 +67,10 @@ #define FLAC_API __declspec(dllimport) #endif +#elif defined(__OS2__) +#define FLAC_API __declspec(dllexport) +#endif + #elif defined(FLAC__USE_VISIBILITY_ATTR) #define FLAC_API __attribute__ ((visibility ("default"))) @@ -73,7 +78,7 @@ #define FLAC_API #endif - +#endif /** These #defines will mirror the libtool-based library version number, see * http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning */ This assumes that Ozkan isn't pursuing his OpenWatcom patches which isn't clear. Either way callers should be able to define FLAC_API. Dave ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
Dave Yeo wrote: > GCC supports __declspec(dllexport) though it still needs a def file, > with no exports. Libtool doesn't currently and as flac uses libtool... So you're happy with this patch? http://lists.xiph.org/pipermail/flac-dev/2017-January/006170.html Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
On 1/23/17, Erik de Castro Lopowrote: > Ozkan Sezer wrote: > >> Anyways, with the changed exports.h patch, every need should >> be met now.. > > > Sorry, which patch is that? > > Erik http://lists.xiph.org/pipermail/flac-dev/2017-January/006170.html ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
Ozkan Sezer wrote: > Anyways, with the changed exports.h patch, every need should > be met now.. Sorry, which patch is that? Erik -- -- Erik de Castro Lopo http://www.mega-nerd.com/ ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
On 1/23/17, Dave Yeowrote: > On 01/22/17 02:00 PM, Ozkan Sezer wrote: >> Question: Does emx support __declspec(dllexport) so I can adjust >> these changes? Because the emx build of the dll seems to have >> exported_everything_ :( > > GCC supports __declspec(dllexport) though it still needs a def file, Eh?? > with no exports. Libtool doesn't currently and as flac uses libtool... > Dave Well that's a bummer. Anyways, with the changed exports.h patch, every need should be met now.. -- O.S. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
On 01/22/17 10:55 AM, lvqcl wrote: Ozkan Sezerwrote: The attached set of patches adds support for OS/2 using Watcom compiler (tested with Open Watcom 1.9). My only interest was building a working dll (the last patch in the set adds a makefile for it), therefore I did not touch other places: If there is interest, I can do so. Patches that remove warnings of DJGPP compiler broke support for Visual Studio 2005/2008. I don't care about these versions really, but I find it very amusing that 20-years old and almost forgotten platforms are more important than 10-years old. ___ I'll note that the next release of (OEM branded) OS/2 is due on Mar 31st. So still not dead. https://www.arcanoae.com/ Dave ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
On 1/22/17, lvqclwrote: > Ozkan Sezer wrote: > >> The attached set of patches adds support for OS/2 using Watcom compiler >> (tested with Open Watcom 1.9). My only interest was building a working >> dll (the last patch in the set adds a makefile for it), therefore I did >> not touch other places: If there is interest, I can do so. > > Patches that remove warnings of DJGPP compiler broke support > for Visual Studio 2005/2008. those patches weren't from me (for the record) > I don't care about these versions really, but I find it very > amusing that 20-years old and almost forgotten platforms > are more important than 10-years old. if you noticed something in these patches that breaks some other platform and/or compiler, please tell. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
Ozkan Sezerwrote: The attached set of patches adds support for OS/2 using Watcom compiler (tested with Open Watcom 1.9). My only interest was building a working dll (the last patch in the set adds a makefile for it), therefore I did not touch other places: If there is interest, I can do so. Patches that remove warnings of DJGPP compiler broke support for Visual Studio 2005/2008. I don't care about these versions really, but I find it very amusing that 20-years old and almost forgotten platforms are more important than 10-years old. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
On 1/22/17, Dave Yeowrote: > On 01/22/17 05:35 AM, Ozkan Sezer wrote: >> The attached set of patches adds support for OS/2 using Watcom compiler >> (tested with Open Watcom 1.9). My only interest was building a working >> dll (the last patch in the set adds a makefile for it), therefore I did >> not touch other places: If there is interest, I can do so. > Disclaimer: I don't know much about EMX. That aside, > Most of the patches can have s/__EMX__/__OS2__/ I intentionally kept __EMX__ checks because, IIRC, old gcc versions (2.8?? can't remember) did define __EMX__ but not __OS2__ > excepting the nasm.h one. > nasm.h should test for OBJ_FORMAT_obj as obj is also correct when > building with GCC flags -Zomf. OK, that can easily be added to configury, but.. > Not sure about the assembly prefix as > generally cdecl is correct for OS/2, perhaps test for defined > (__WATCOMC__) && defined (__OS2__) Yeah: Default calling convention for Watcom is not __cdecl it is, IIRC, __watcall and it doesn't prepend underscore to the symbols > > Will the GCC built flac8.dll link with Watcom with something like > diff --git a/include/FLAC/export.h b/include/FLAC/export.h > index d52f0bb..96d5422 100644 > --- a/include/FLAC/export.h > +++ b/include/FLAC/export.h > @@ -69,6 +69,9 @@ > #elif defined(FLAC__USE_VISIBILITY_ATTR) > #define FLAC_API __attribute__ ((visibility ("default"))) > > +#elif defined (__WATCOMC__) && defined (__OS2__) > +#define FLAC_API __declspec(__cdecl) > + > #else > #define FLAC_API As I said, I don't know much about emx, but the wrong thing about the above is that it doesn't use dllexport therefore nothing will be exported with this. > > Not sure if a OMF import lib is required but easy enough to create with > implib or emximp > Dave Don't know about this either. [The reason I choose Watcom over emx/gcc is that I can compile on linux using Watcom, however the emx stuff still aren't ported to linux making cross-compiling is not possible and that's a big no for me.] -- O.S. ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
Re: [flac-dev] os/2 support using Watcom
On 01/22/17 05:35 AM, Ozkan Sezer wrote: The attached set of patches adds support for OS/2 using Watcom compiler (tested with Open Watcom 1.9). My only interest was building a working dll (the last patch in the set adds a makefile for it), therefore I did not touch other places: If there is interest, I can do so. Most of the patches can have s/__EMX__/__OS2__/ excepting the nasm.h one. nasm.h should test for OBJ_FORMAT_obj as obj is also correct when building with GCC flags -Zomf. Not sure about the assembly prefix as generally cdecl is correct for OS/2, perhaps test for defined (__WATCOMC__) && defined (__OS2__) Will the GCC built flac8.dll link with Watcom with something like diff --git a/include/FLAC/export.h b/include/FLAC/export.h index d52f0bb..96d5422 100644 --- a/include/FLAC/export.h +++ b/include/FLAC/export.h @@ -69,6 +69,9 @@ #elif defined(FLAC__USE_VISIBILITY_ATTR) #define FLAC_API __attribute__ ((visibility ("default"))) +#elif defined (__WATCOMC__) && defined (__OS2__) +#define FLAC_API __declspec(__cdecl) + #else #define FLAC_API Not sure if a OMF import lib is required but easy enough to create with implib or emximp Dave ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev
[flac-dev] os/2 support using Watcom
The attached set of patches adds support for OS/2 using Watcom compiler (tested with Open Watcom 1.9). My only interest was building a working dll (the last patch in the set adds a makefile for it), therefore I did not touch other places: If there is interest, I can do so. Regards. -- O.S. 0001-exports.h-properly-define-FLAC_API-when-building-a-d.patch Description: Binary data 0002-share-compat.h-properly-define-fseeko-ftello-and-FLA.patch Description: Binary data 0003-share-compat.h-add-__OS2__-to-list-of-cpp-checks-for.patch Description: Binary data 0004-metadata_iterators.c-add-__OS2__-to-the-list-of-cpp-.patch Description: Binary data 0005-bitreader.c-bitwriter.c-solve-the-inline-issue-for-W.patch Description: Binary data 0006-bitmath.h-provide-a-FLAC__clz_uint32-inline-asm-solu.patch Description: Binary data 0007-lpc.c-provide-a-solution-for-missing-lround-for-Watc.patch Description: Binary data 0008-ia32-nasm.h-for-Watcom-OS-2-asm-files-should-be-buil.patch Description: Binary data 0009-add-a-Watcom-makefile-to-build-an-OS-2-dll.patch Description: Binary data ___ flac-dev mailing list flac-dev@xiph.org http://lists.xiph.org/mailman/listinfo/flac-dev