#23368 - doudou - Sun Jul 11, 2004 2:25 am
I'm trying to use Apex. I want the Apex architecture to be invisble to my game. Since I have developped a generic GBA engine that produce a MyGenericGBAEngine.o that I link with my game files to create my .gba, I would like to have it encapsulated in MyGenericGBAEngine.o.
Simple question : how do I link the a compiled file when I compile MyGenericGBAEngine ?
ps : I'm using DevKitAdv without MakeFiles, just batch files
#23373 - jd - Sun Jul 11, 2004 5:55 am
doudou wrote: |
I'm trying to use Apex. |
Would I be right in thinking that by "Apex" you mean the Apex Audio System?
doudou wrote: |
I want the Apex architecture to be invisble to my game. |
What do you mean by "invisible"? You're going to need to use AAS's API to get it do anything.
doudou wrote: |
Since I have developped a generic GBA engine that produce a MyGenericGBAEngine.o that I link with my game files to create my .gba, I would like to have it encapsulated in MyGenericGBAEngine.o. |
You want to put AAS in the same object file as your code? To the best of my knowledge that isn't possible, although I'm not sure what the benefit would be.
doudou wrote: |
Simple question : how do I link the a compiled file when I compile MyGenericGBAEngine ?
|
If you include "-lAAS" at the linking stage then "libAAS.a" (which is basically a collection of .o files) will be linked to your project, assuming that you've got libAAS.a in your library search path (you can add extra folders with the "-L" switch).
doudou wrote: |
ps : I'm using DevKitAdv without MakeFiles, just batch files |
I'd recommend you switch to using proper makefiles as they're easier in the long run and there's more to getting AAS working than just linking the library to your project - it's all shown in the example makefiles.
#23391 - sajiimori - Sun Jul 11, 2004 6:26 pm
I think he wants to wrap the AAS interface with his own module, and then hide AAS from all other modules. On a system with an OS you would use a dynamically linked library to do this, but does anybody know an easy way in a bare environment?
Since all the AAS symbols have a prefix, it should be easy to avoid using them accidentally. If you're still concerned about perfect encapsulation, you should be using C++. If you are using C++, you can recompile AAS, wrapping everything in a namespace.
#23441 - doudou - Tue Jul 13, 2004 1:28 am
sajiimori is right about my intention of wrapping AAS with my own sound module.
But for right now, I would accept to link it directly in my game. I tried this :
g++ -lAAS -mthumb -mthumb-interwork -o MyGame.elf Framework.o main.o
and I have this error :
c:\projets\gba\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\bin\ld.exe: cannot find -lAAS
collect2: ld returned 1 exit status
I don't have libAAS.a in my library path, but I put libAAS.a in my game folder.
#23444 - doudou - Tue Jul 13, 2004 1:40 am
ok, there is a progression. I putted the libAAS.a in my lib folder and I now have this :
libAAS.a(AAS_MOD.o): In function `AAS_MOD_SetSongPos':
AAS_MOD.o(.text+0xbc): undefined reference to `AAS_Sequence'
AAS_MOD.o(.text+0xc8): undefined reference to `AAS_PatternData'
c:\projets\gba\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\libAAS.a(AAS_MOD.o): In function `AAS_MOD_Play':
AAS_MOD.o(.text+0x2e4): undefined reference to `AAS_DATA_NUM_MODS'
Is there another .a that I should use ?
#23445 - jd - Tue Jul 13, 2004 2:15 am
doudou wrote: |
libAAS.a(AAS_MOD.o): In function `AAS_MOD_SetSongPos':
AAS_MOD.o(.text+0xbc): undefined reference to `AAS_Sequence'
AAS_MOD.o(.text+0xc8): undefined reference to `AAS_PatternData'
c:\projets\gba\devkitadv\bin\..\lib\gcc-lib\arm-agb-elf\3.2.2\..\..\..\..\arm-agb-elf\lib\libAAS.a(AAS_MOD.o): In function `AAS_MOD_Play':
AAS_MOD.o(.text+0x2e4): undefined reference to `AAS_DATA_NUM_MODS'
|
You also need to run Conv2AAS to convert all your sound files (.mod/.raw/.wav) into two files: AAS_Data.s and AAS_Data.h. AAS_Data.s contains the sound data and should be assembled and linked to your project (this will fix the errors above) and AAS_Data.h should be #included in your code.