gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Compiling to a shared object or using overlays

#172276 - Tommmie - Thu Jan 28, 2010 5:18 pm

Hey everyone,

just to keep it short:):
Does someone know how you can compile your sources to a shared object (an elf file)? normally you'll also get an elf file, but that's not the kind of elf file I want. I already tried some copy and pastes in my makefile, but that didn't work.

I already have this line in my makefile, but what additional code do I need?:

Code:
CFLAGS   +=   $(INCLUDE) -DARM9 -fPIC -shared


Last edited by Tommmie on Sun Jan 31, 2010 12:02 pm; edited 1 time in total

#172290 - Abcd1234 - Fri Jan 29, 2010 6:10 am

Well, unless you plan to write a dynamic linker for the DS, too, I don't expect this'll work the way you're hoping it will. :)

OOC, what's your goal, anyway? The only reason I can think of to dynamically load code on the DS is for some sort of plugin model...

#172291 - Lino - Fri Jan 29, 2010 6:58 am

like DLDI

#172292 - Tommmie - Fri Jan 29, 2010 7:21 am

Abcd1234 wrote:
Well, unless you plan to write a dynamic linker for the DS, too, I don't expect this'll work the way you're hoping it will. :)

OOC, what's your goal, anyway? The only reason I can think of to dynamically load code on the DS is for some sort of plugin model...


I once made something like dldi, but that wasn't working that well, now I'm planning to make an ELF loader. So instead of a plugin I would have a shared lib/object

#172293 - Lino - Fri Jan 29, 2010 7:29 am

After the compilation you havent an ELF file but only code (otherwise you must remove the objcopy). You must write a simple patcher/loader like,again, DLDI.

#172313 - Tommmie - Sat Jan 30, 2010 8:45 am

shared libs are ELF files aren't they? and with normal compilation of a program you'll also get an elf file and some object files(also elf). So isn't it supported by devkitARM to compile to a shared lib or is it possible?

edit Okay, overlays look also fine to me, but how do you create them? I found an old post about it, but couldn't get it to work(it wasn't really clear to me what to do):

http://forum.gbadev.org/viewtopic.php?t=14707&highlight=overlay