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 16 14:37:13 PST 2016


On Friday, 16 December 2016 at 00:40:07 UTC, Mike Parker wrote:
> On Thursday, 15 December 2016 at 20:34:47 UTC, hardreset wrote:
>> On Thursday, 15 December 2016 at 18:30:14 UTC, hardreset wrote:
>>>
>>> I have pragma(lib,**fullpath**) in my freetype.d file, is 
>>> that the correct way?
>>
>> Never mind, figured it out, I needer to add
>>
>> "libs": ["libs/freetype27ST"]
>>
>> to dub.json
>
> The pragma alone should have been enough. Did you get the path 
> right? At any rate, if you're adding that line to dub.json, 
> then the pragma is redundant. They both do the same thing.

Im pretty sure i did, i tried absolute path, relative, just 
filename, copied from address bar, etc..

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?





More information about the Digitalmars-d-learn mailing list