www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - D and devkitARM

reply TheGag96 <thegag96 gmail.com> writes:
Hi guys, for a possibly-in-over-my-head project I'd like to get 
working a simple "Hello World" type program in which I call a D 
function from C in a 3DS homebrew app (or maybe even have it all 
in plain D with bindings to libctru). The thing is, I'm not 
skilled with Makefiles so I don't have a clue on how to correctly 
set up the toolchain for linking everything. I can compile some 
D-calling C code just fine with dmd and gcc on Linux (though I 
can't get anything working with gdc for whatever reason). Would 
anyone be able to point me in the right direction?

This is the example Makefile for a 3DS homebrew app: 
http://pastebin.com/fcJrrMg9 It seems like there would be issues 
differentiating the .d build definition files from D source 
files...

Thanks!
Mar 08 2016
parent reply Nicholas Wilson <iamthewilsonator hotmail.com> writes:
On Wednesday, 9 March 2016 at 00:34:44 UTC, TheGag96 wrote:
 Hi guys, for a possibly-in-over-my-head project I'd like to get 
 working a simple "Hello World" type program in which I call a D 
 function from C in a 3DS homebrew app (or maybe even have it 
 all in plain D with bindings to libctru). The thing is, I'm not 
 skilled with Makefiles so I don't have a clue on how to 
 correctly set up the toolchain for linking everything. I can 
 compile some D-calling C code just fine with dmd and gcc on 
 Linux (though I can't get anything working with gdc for 
 whatever reason). Would anyone be able to point me in the right 
 direction?

 This is the example Makefile for a 3DS homebrew app: 
 http://pastebin.com/fcJrrMg9 It seems like there would be 
 issues differentiating the .d build definition files from D 
 source files...

 Thanks!
Hmm. I apologise that this post is not in any logical order. dmd can only compile for x86 so you will have to use ldc or gdc makefiles are generally not used in d. you should be able to use the dub project settings file (dub.json or dub.sdl) to do most of the standard linking, as for some of the deeper magic I'm not sure. versioning: i'm not sure that d has a 3ds target version but it has an arm one. includes should not be an issue. If you cannot find bindings for ctru see if dstep can do it for you. I don't know what .v.pica or .shlist files are but you can use string imports to reference the data looks like the same idea can be used for the shader rule. However you may need to use a prehook script to call whatever "picassso" does first.
Mar 10 2016
parent TheGag96 <thegag96 gmail.com> writes:
On Thursday, 10 March 2016 at 14:36:26 UTC, Nicholas Wilson wrote:
 Hmm.

 I apologise that this post is not in any logical order.

 dmd can only compile for x86 so you will have to use ldc or gdc

 makefiles are generally not used in d. you should be able to use
 the dub project settings file (dub.json or dub.sdl) to do most 
 of
 the standard linking, as for some of the deeper magic I'm not 
 sure.

 versioning: i'm not sure that d has a 3ds target version but it 
 has
 an arm one. includes should not be an issue.

 If you cannot find bindings for ctru see if dstep can do it for 
 you.

 I don't know what .v.pica or .shlist files are but you can use
 string imports to reference the data looks like the same idea
 can be used for the shader rule. However you may need to use a 
 prehook
 script to call whatever "picassso" does first.
Thanks for the suggestions. I know I need to use gdc, specifically the one found at ftp://ftp.gdcproject.org/binaries/devkitARM/ (or build it myself if this doesn't work for whatever reason). I'm starting to think a bigger problem aside from the Makefiles is just getting any D to compile with that gdc version at all. I'm pretty sure I need some sort of bare metal runtime. Would this be something that could work, or should I look elsewhere? https://bitbucket.org/timosi/minlibd ...This probably really is above my knowledge level, but I suppose I'll never learn if I don't give it a shot. Like I said, if anyone has any sort of advice on how I should approach this, I'd be happy to hear it.
Mar 10 2016