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 

KernelPollCallbacks?

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



Joined: 07 Jun 2005
Posts: 70

PostPosted: Sun Jul 10, 2005 10:55 am    Post subject: KernelPollCallbacks? Reply with quote

Hi,

I have check some examples and KernelPollCallbacks appears, but it seems not to exist in pspsdk ( I did a full search on the pspsdk files), any idea?.


HexDump.
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Sun Jul 10, 2005 11:02 am    Post subject: Reply with quote

That was a made up name, it's really called sceKernelSleepThreadCB().

As always look at the PSPSDK samples - it appears in the exit handler.
Back to top
View user's profile Send private message
HexDump



Joined: 07 Jun 2005
Posts: 70

PostPosted: Sun Jul 10, 2005 9:17 pm    Post subject: Reply with quote

thanks a lot MrBrown. A little more thing, I have copied and pasted the callback code from the example and I get this error

main.cpp invalid conversion from 'void (*)(void*)' to 'void*' .

It worked when I compled the example but not in my code. It is strange you should allways pass a Funcion name as a void*, any help please?.

NOTE: I´m compiling c++ code, and the example c code, perhaps this is the problem.

HexDump.
Back to top
View user's profile Send private message
jimbo



Joined: 31 Mar 2005
Posts: 6
Location: Sunny Southern CA

PostPosted: Mon Jul 11, 2005 3:38 am    Post subject: Reply with quote

I am getting a similar error using psptoolchain-20050705.tgz and PSPSDK-svn rev 579(2005-7-10). I renamed main.c to main.cpp in the cube, wavegen, and fileio samples and I get the following errors:
Code:

main.cpp: In function 'void CallbackThread(void*)':
main.cpp:39: error: invalid conversion from 'int (*)()' to 'void*'
main.cpp:39: error:   initializing argument 2 of 'int sceKernelCreateCallback(const char*, void*, void*)'
main.cpp: In function 'int SetupCallbacks()':
main.cpp:50: error: invalid conversion from 'void (*)(void*)' to 'int (*)(SceSize, void*)'
main.cpp:50: error:   initializing argument 2 of 'SceUID sceKernelCreateThread(const char*, int (*)(SceSize, void*), int, int, SceUInt, SceKernelThreadOptParam*)'
make: *** [main.o] Error 1

Does C++ use a different convention for function pointers?
Back to top
View user's profile Send private message Visit poster's website AIM Address
Zeta



Joined: 09 Jul 2005
Posts: 9

PostPosted: Mon Jul 11, 2005 3:41 am    Post subject: Reply with quote

I think so. I tried the same and so that it would work I had to change any function as parameter to (void*)&nameoffunction. With this it worked fine.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Mon Jul 11, 2005 3:44 am    Post subject: Reply with quote

C++ has stricter type checking that C does, in C passing any pointer to void * will be autoconverted, in C++ it will complain. Either you do something like sceKernelCreateCallback("MyCallback", static_cast<void *>(CallbackThread), ...) or actually make sure your thread function has the correct prototype.
Back to top
View user's profile Send private message
Zeta



Joined: 09 Jul 2005
Posts: 9

PostPosted: Mon Jul 11, 2005 9:43 am    Post subject: Reply with quote

That is much more correct and safe, I wish I wasn't so forgetful about type casting in c++ :(
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