libsdl-org/SDL_ttf

TTF_RenderUTF8_LCD and related functions are not being exported to SDL2_ttf.a

cpicanco opened this issue · 6 comments

Hi, I suspect that some functions are not being exported to SDL2_ttf.a (x64). TTF_RenderUTF8_Solid works just fine, but I am unable to static link when using the following functions:

TTF_RenderUTF8_Solid_Wrapped
TTF_RenderUTF8_LCD
TTF_RenderUTF8_LCD_Wrapped
TTF_RenderText_LCD
TTF_RenderText_LCD_Wrapped
TTF_RenderText_Solid_Wrapped
...
And more

madebr commented

Are you sure the static library has version >= 2.0.18?

SDL_ttf/SDL_ttf.h

Lines 1119 to 1126 in ff7b094

* \since This function is available since SDL_ttf 2.0.18.
*
* \sa TTF_RenderUTF8_Shaded_Wrapped
* \sa TTF_RenderUTF8_Blended_Wrapped
* \sa TTF_RenderUTF8_LCD_Wrapped
*/
extern DECLSPEC SDL_Surface * SDLCALL TTF_RenderUTF8_Solid_Wrapped(TTF_Font *font,
const char *text, SDL_Color fg, Uint32 wrapLength);

I am using SDL2_ttf.a from SDL2_ttf-devel-2.20.2-mingw.zip.I opened this issue because other people reported similar problems with dinamic dlls. Am I doing something wrong???

madebr commented

I just verified the 2.20.2 released mingw binaries, and they contain TTF_RenderUTF8_Solid_Wrapped.

You need to make sure you're actually linking to libSDL2_ttf.a from the downloaded package, and not one provided by your system.
Verify your link command, and make sure it contains the full path to libSDL2_ttf.a, not simply -lSDL2_ttf.

I am linking using the fullpath now and still getting the same error:

Captura de tela 2023-06-17 124420

Captura de tela 2023-06-17 124839

I also cleaned up everything and fully recompile the executable.

madebr commented

So linking succeeds. It's when running your app an error appears.
This happens when there's an older SDL2_ttf.dll lingering around on your system.

Do a system-wide search for SDL2_ttf.dll, including C:|Windows (and subdirectories).
Remove, or replace, all SDL2_ttf.dll libraries with the newer version.

Or make sure all SDL2 libraries SDL2_ttf.dll are placed in the same directory as your app.

So linking succeeds. It's when running your app an error appears. This happens when there's an older SDL2_ttf.dll lingering around on your system.

Do a system-wide search for SDL2_ttf.dll, including C:|Windows (and subdirectories). Remove, or replace, all SDL2_ttf.dll libraries with the newer version.

Or make sure all SDL2 libraries SDL2_ttf.dll are placed in the same directory as your app.

So, there was an older SDL2_ttf.dll lingering around on my system. Now there is just the right one!