GP32 Fseek


pea

developer
Joined
Oct 3, 2004
Messages
1,089
Age
46
Location
New Zealand
Website
www.projectitis.com
Hi all,

Currently trying to get libmikmod to work with Mr. Mirkos SDK, and am about 98% there. There are only three or four functions I need to replace, which relate to loading files off SMC, but as I don't really understand these functions, I thought I would ask:

This is Offical SDK
result = GpFileSeek(reader->file, FROM_CURRENT, 0, &new_offset);

1) What does 'seeking' a file do?
2) The 'value' of the seek is stored in new_offset, right?

This is Mr.Mirkos:
result = smc_fseek(reader->file, 0, SEEK_CUR);

3) Where is the 'value' of the seek stored here?
 
Anyone know what causes this:

I compile the libmikmod library ok. It includes Mr.Mirkos SDK functions, and has #include "fileio.h" at the top. All works fine.

Then I try to compile my test program that loads and plays a MOD, and I link in the mikmod lib. I get the following error:
Code:
../lib/libmikmod.a(mmio.o)(.text+0x2d8): In function `cache_get':
: undefined reference to `smc_fseek'
 
pea posted on Mar 1 2005 at 05:03 PM said:
Anyone know what causes this:

I compile the libmikmod library ok. It includes Mr.Mirkos SDK functions, and has #include "fileio.h" at the top. All works fine.

Then I try to compile my test program that loads and plays a MOD, and I link in the mikmod lib. I get the following error:
Code:
../lib/libmikmod.a(mmio.o)(.text+0x2d8): In function `cache_get':
: undefined reference to `smc_fseek'

You need to make sure that libmikmod is before libmirko in the library path. Otherwise when it links libmirko in it doesn't grab the smc_fseek() object code.
 
Last edited by a moderator:
pea posted on Mar 1 2005 at 09:55 PM said:
Hi,

Thanks, that fixed it. Still don't know exactly why, but cheers :)
Anyway, it compiles now, but no sound. Debugging ahead.... oh boy.

It is because only the functions in the library that are used in your program are linked in. So as the linker is going it makes a list of the functions it needs to find. As it goes through the libraries, it finds these functions, links them in and removes them from the list.

So, if libmirko is on the list first then it doesn't realize it needs smc_fseek(). Put another way, it adds smc_fseek to the list AFTER it has already linked in libmirko.
 
Last edited by a moderator:
ah ok.

I have another problem now that might be related...

I now have another .h file that I am #include'ing in, and it throws an error when it tried to find those functions! Any idea?

i have used this unit many times before, no probs.

At the top
#include "gp_graphics.h"

In the code
lcd = gp_lcdCreate( 85, 0xffff );

Error:
player.o(.text+0x20): In function `main':
: undefined reference to `gp_lcdCreate'
 
If you ever get libmikmod to work, I might be interested in digging up my gpamp source and hacking it in there.

hmmmm, xm support :)
 
Back
Top