PDA

View Full Version : Using Objective-C in NDS Development



wraggster
February 2nd, 2011, 00:11
News via http://irwansyah.drunkencoders.com/2011/01/31/using-objective-c-in-nds-development/

Well, I finally got the time to get my hands dirty on looking for ways to using one of my favorite programming language, that is Objective-C in NDS Development. Recently, I changed my path from the previously doing enterprise applications using C# into the world of iPhone development using Objective-C. I was freaked out the first time I try the Objective-C language and the tools involved. Everything looked different! The tools behave unfriendly, especially the debugger…Oh my god! No, graphical and intuitive ways to look into variables, especially arrays and collections. I was thinking I was entering a primitive civilization!

After, several weeks using it! Hmm…I am beginning to like it! I feel very easy to do modification or changes in classes that I’ve written. Every methods is virtual by nature in Objective-C, the Protocols, Categories, Notifications, its feels like I am programming using a scripting language. Also, the Cocoa! Its amazing! It’s very easy to do user interface especially animations. And interface builder, I LOVE IT! It just provided what I really needs.

When, I was trying to compile my first NDS program. I was thinking, it must be good to have Objective-C in NDS Development. I don’t know wether it was possible. I tried to wrote a simple Objective-C class then I compiled it using devkitARM. It was successful to produce the object file but the linker was complaint! The linker said it cannot found the Objective-C runtime. I tried to modify the linker rules file and no luck. I’ve tried Googling but I found no references. I’ve tried asking in devkitPro.org forum but no one answer! :( It was seemed no hope!

I just leave it be until the next week I tried it again. This time I tried to find command arguments of the linker. Because, devkitARM is using the arm-eabi compiler from Sourcery that is based on GCC then the Objective-C compiler is already there. I already proved that it can compiled Objective-C file. I just need to find a way to link it using the linker. It turns out that I just need to add one additional command line arguments to include the Objective-C runtime. And then, it successfully compiled and linking my Objective-C program. I’ve tried to instruct it to draw a pixel and a diagonal line to the screen and I was very happy to finally see the pixel and the line drawn on the screen. I’ve done it using Objective-C! :D

Ooh! What a relief!

The journey, just begun