Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows DLL compilation using Msys2. 'Error: Implicit declaration of function Synthesis' #45

Open
joshua-rodgers opened this issue Jul 30, 2024 · 1 comment

Comments

@joshua-rodgers
Copy link

When attempting to compile to a windows DLL using MinGW in MSYS2 on windows, I receive the following warning when linking:

Standalone/synth.c: In function ‘process_one_file’:
Standalone/synth.c:284:28: warning: implicit declaration of function ‘Synthesis’ [-Wimplicit-function-declaration]
284 | stream_eof=Synthesis(mb);
| ^~~~~~~~~

which ultimately results in this error:

/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: Bin/Standalone/Standalone/synth.o:synth.c:(.text+0x148d): undefined reference to Synthesis' /usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: Bin/Standalone/Misc/audio.o:audio.c:(.text+0xfb): undefined reference to linear2ulaw'
/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: Bin/Standalone/Misc/audio.o:audio.c:(.text+0x165): undefined reference to linear2alaw' /usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: Bin/Standalone/Misc/audio.o:audio.c:(.text+0x229): undefined reference to linear2ulaw'
/usr/lib/gcc/x86_64-pc-msys/13.2.0/../../../../x86_64-pc-msys/bin/ld: Bin/Standalone/Misc/audio.o:audio.c:(.text+0x238): undefined reference to `linear2alaw'
collect2: error: ld returned 1 exit status
make: *** [Makefile:131: mbrola] Error 1

I have defined '#define DLL' and '#define __i386'. if I remove the DLL define I get a functioning executable. It appears that a preprocessor conditional relying on the '#define LIBRARY' directive is causing the function Synthesis within mbrola.c not to be defined. I have added pragma statements before and after the preprocessor '#else' around line 939 of mbrola.c to test this. When LIBRARY is defined, the function Synthesis is not defined, However, the DLL is dependent on LIBRARY given this preprocessor directive from common.h:

/* The Dll version is based on the library one -> export DLL functions */
#ifdef DLL

include "windows.h"

define LIBRARY

define DLL_EXPORT WINAPI

#else

define DLL_EXPORT

#endif

@joshua-rodgers
Copy link
Author

I've managed to get operational using the pre-compiled DLL found in the Releases in this fork:
https://github.com/thiekus/MBROLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant