Anybody use Derelict FreeType recently (successfully)

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 16 22:27:07 PDT 2015


On Thursday, 17 September 2015 at 04:58:05 UTC, WhatMeWorry wrote:
>
> Compiling and linking was error free, but when I hit
>
> DerelictFT.load();
>
> my program aborts with the following run time message:
>
> derelict.util.exception.SymbolLoadException at source\derelict\util\exception.d(35): Failed to load symbol FT_Reference_Face from shared library freetype.dll

This function was added to FreeType in version 2.4.2, so you will 
see this error when trying to load an older version.

>
> First of all, I'm not sure if I have a valid freetype.dll file. 
> How does one tell?  I downloaded freetype-2.6 but couldn't find 
> anything there.  I downloaded freetype-2.3.5 and found a 
> freetype6.dll which I renamed to freetype.dll because that was 
> want an online discussion said.

DerelictFT currently requires FreeType 2.5 or later (though I've 
not yet looked into updating to the 2.6 API). What problem did 
you have with the 2.6 binary you downloaded?

Using the 2.3.5 and 2.4.2 binaries is bound to result in 
SymbolLoadExceptions, as any functions added in 2.5 will not be 
present in those binaries. You can work around this by building 
your own if you can't find anything precompiled online, but if 
you aren't using any 2.5 features, I would suggest you look into 
using DerelictUtil's selective symbol loading mechanism[1]. 
You'll need to decide a minimum version of FreeType to support, 
then diff the headers from that version with later releases to 
see which functions were added in later versions. Check for those 
functions in a MissingSymbolCallback and you can load without any 
SymbolLoadExceptions.

Also, an alternative to renaming the DLL is to pass the name 
directly to the loader:

Version(Windows) DerelictFT.load("freetype6.dll");
else DerelictFT.load();

[1] http://derelictorg.github.io/using/fail.html


More information about the Digitalmars-d-learn mailing list