Search code examples
c#winformssdlsdl-2sdl-ttf

C# SDL2.SDL_ttf.TTF_Init returning an error on the user's machine


My project (executable file) works fine on my machine, but for some reason, on the user's machine program just can't start. Here is the error that I find in windows logs (sry it's on Russian but you can see that the problem is in missing dll) - enter image description here

But I am sure that the SDL_ttf library is in the project folder right next to the executable! enter image description here

So I can't really understand why the application is not working on the user's machine and works just fine on mine.

NOTE: I am using the binding if the SDL library from c++ written by flibitijibibo - https://github.com/flibitijibibo/SDL2-CS


Solution

  • SDL2_ttf.dll, as many others, have some dependencies. E.g. if you download runtime package compiled with MSVC, you'll see SDL2_ttf.dll, libfreetype-6.dll and zlib1.dll. If you'll load it into dependency walker you'll see it also depends on kernel32.dll, msvcrt.dll (pre-installed on windows) and SDL2.dll, all of which have to be present on target system. Generally "DLL not found" means "DLL can't be loaded for whatever reason".