Simplest way to build a DMD compatible C lib, and how to link using DUB.
hardreset via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Dec 23 16:42:18 PST 2016
On Saturday, 17 December 2016 at 04:58:45 UTC, Mike Parker wrote:
> 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.
Yeah that was it. I had it in a separate folder for libs and
mistakenly assumed that because it was importing OK that mean it
was being compiled and linked too. I moved it into the source
folder and it worked fine! It makes sense now.
thanks for the help!
More information about the Digitalmars-d-learn
mailing list