Simplest way to build a DMD compatible C lib, and how to link using DUB.

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 16 20:58:45 PST 2016


On Friday, 16 December 2016 at 22:37:13 UTC, hardreset wrote:

> To be honest I was having some odd linking problems anyway. I 
> initially wrapped the FT init function in plain D function and 
> that kept causing "_FT_.... not found" link errors. As soon as 
> I took all the actual D functions out and left just FT 
> declarations in there it stopped. Even now if I add...
>
> int foo() { return 0; }
>
> to my freetype.d (contains just FT interface declarations)
>
> and call it from font.d (my font class)
>
> i start getting linker errors. Why would adding a plain D 
> function suddenly make it sound the linker cant find what it 
> needs in the freetype.lib?

The only thing I can think of offhand: did you compile and link 
your freetype.d? As long as it's just interface declarations, 
there's no need to -- it only needs to be on the import path. But 
once you start adding implementations, it needs to be compiled 
and linked into the executable.


More information about the Digitalmars-d-learn mailing list