Welcome! Log In Create A New Profile

Advanced

Using libraries

Posted by iofthestorm 
Using libraries
January 13, 2009 11:41PM
Hi, I'm kind of new to C and completely new to Wii programming but I have a fair bit of experience with other languages and am very enthusiastic about learning. So, over the past two days I've made a program that will download a file you specify (see here) and experienced my fair share of code dumps and infinite loops. Fun times.

Anyway, this is all in preparation of writing an RSS reader/web browser (let it never be said that I pick easy first projects ;-) ). This will be a lot easier if I can use some libraries, but I don't really know how to use stuff that's not included with devkitppc. I want to use mini-xml, but I don't know how to get started. Do I need to recompile this for PPC or anything, or basically how should I proceed?

Edit: Solved by people on #wiidev, at least for the time being. Someone already ported mxml to Wii, and it is here: [code.google.com] . But I still would be interested in general links on how libraries work, how to compile them, how to create them, etc.



Edited 2 time(s). Last edit at 01/14/2009 12:03AM by iofthestorm.
Re: Using libraries
January 14, 2009 11:58PM
First off, we're always talking C/C++ code here (eg: x86 ASM is a no-go).

For compiling existing libraries for use on the Wii, see the set of instructions I included in the Freetype compile I did. This applies to other libraries as well. They call this "cross-compiling" - meaning compiling on one architecture (eg: x86) for another (PPC). Some libraries compile without any modifications required, while others may have "endian" issues, in which case the code needs to be modified to use big-endian. There may be other incompatibilities for various reasons (eg: C standards, buffer sizes, file access code, etc). But, again, many of the well-established and better written libraries already avoid these issues.

For using a library, you need to include it in your makefile (eg: -lmxml), and use an #include for the .h file.

For making your own Wii library, there are some best-practices (eg: global vars are bad), and other than that, just compile your code into a .a file, and you're ready to go! A library as far as the Wii is concerned is just some precompiled code, very little black arts voodoo magic is involved. ;)
Re: Using libraries
January 15, 2009 12:14AM
I don't know x86 asm unfortunately, only a little MIPS ;-). Cool, thanks for the info. I still don't quite understand how you compile to a .a file, but I'll probably look more into it later. Is a .a file the same as a .dol but not executable or something? And isn't compiling for the wii on your PC already cross compiling anyway?
Sorry, only registered users may post in this forum.

Click here to login