Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.
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!
Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.
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?
Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.
On Thursday, 15 December 2016 at 18:30:14 UTC, hardreset wrote: On Thursday, 15 December 2016 at 03:47:27 UTC, Mike Parker wrote: [1] https://github.com/DerelictOrg/DerelictFT Thanks, I'm trying the "-m32mscoff" method for now, but I get "error LNK2019: unresolved external symbol _FT_Init_FreeType referenced" 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
Re: Simplest way to build a DMD compatible C lib, and how to link using DUB.
On Thursday, 15 December 2016 at 03:47:27 UTC, Mike Parker wrote: On Wednesday, 14 December 2016 at 23:08:30 UTC, hardreset wrote: As Basile recommended, DerelictFT[1] will save you from the hassle of object formats. It's a dynamic binding, so you don't need to link with FreeType at all during compilation. You simply call DerelictFT.load during initialization and it will load the FreeType DLL for you. However, if your goal is to use DLLs, then you either have to use the MS linker as I described above or get FreeType into the OMF format (either by compiling with DMC or using an object converter). [1] https://github.com/DerelictOrg/DerelictFT Thanks, I'm trying the "-m32mscoff" method for now, but I get "error LNK2019: unresolved external symbol _FT_Init_FreeType referenced" I have pragma(lib,**fullpath**) in my freetype.d file, is that the correct way?
Simplest way to build a DMD compatible C lib, and how to link using DUB.
I built Freetype with MSVC13 and tried to link it but DMD didnt like the format, so what should compiler (free) should I use for building DMD compatible static libs? Once I've build the lib, made a di file, where do I put these things in the dub directory structure? thanks,
Re: Avoiding GC
On Thursday, 27 October 2016 at 07:52:09 UTC, Guillaume Piolat wrote: On Wednesday, 26 October 2016 at 08:18:07 UTC, hardreset wrote: Is there a page somewhere on how to program D without using the GC? The information is scattered. How do I allocate / free structs / classes on the heap manually? Classes => https://github.com/AuburnSounds/dplug/blob/master/core/dplug/core/nogc.d#L122 Thanks. I notice you avoid GC altogether in dplug. Whats the reason for total avoidance as apposed to just avoiding it in the real time code?
Avoiding GC
Is there a page somewhere on how to program D without using the GC? How do I allocate / free structs / classes on the heap manually? New would be GCed memeory wouldnt it? Delete is being depreciated? thanks.