forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Is this a bug (_ctype_)?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
peeveen



Joined: 04 Jul 2005
Posts: 1
Location: Glasgow, Scotland

PostPosted: Mon Jul 04, 2005 10:41 pm    Post subject: Is this a bug (_ctype_)? Reply with quote

Hi there,
Been experimenting with the PSPSDK, with a view to making some homebrew goodies ...

I wrote a tiny bit of code to test it out, just a main function with a couple of calls to functions from <string.h> and <ctype.h>.

When compiling with psp-gcc, I kept getting linker errors about "undefined reference to _ctype_".

After much headbanging, I realised that if I compile the code with the -O2 compiler switch, it works fine.

As far as I can see, this switch is to do with optimisation. Why would it have this effect?

Apologies if I'm doing something obviously wrong, I'm not really accustomed to this whole unix/toolchain/gnu way of doing things.
Back to top
View user's profile Send private message
mc



Joined: 12 Jan 2005
Posts: 212
Location: Linköping

PostPosted: Tue Jul 05, 2005 12:46 am    Post subject: Reply with quote

PSPSDK does not provide a ctype.h of its own, so you are actually using the newlib ctype.h. However, since you are not _linking_ with newlib, the global ctype table used by the header file will not be available.

The reason it works with optimization is probably that the code which actually uses ctype gets optimized away...
_________________
Flying at a high speed
Having the courage
Getting over crisis
I rescue the people
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group