| View previous topic :: View next topic |
| Author |
Message |
HexDump
Joined: 07 Jun 2005 Posts: 70
|
Posted: Sun Jul 10, 2005 10:55 am Post subject: KernelPollCallbacks? |
|
|
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 |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Sun Jul 10, 2005 11:02 am Post subject: |
|
|
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 |
|
 |
HexDump
Joined: 07 Jun 2005 Posts: 70
|
Posted: Sun Jul 10, 2005 9:17 pm Post subject: |
|
|
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 |
|
 |
jimbo
Joined: 31 Mar 2005 Posts: 6 Location: Sunny Southern CA
|
Posted: Mon Jul 11, 2005 3:38 am Post subject: |
|
|
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 |
|
 |
Zeta
Joined: 09 Jul 2005 Posts: 9
|
Posted: Mon Jul 11, 2005 3:41 am Post subject: |
|
|
| 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 |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Mon Jul 11, 2005 3:44 am Post subject: |
|
|
| 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 |
|
 |
Zeta
Joined: 09 Jul 2005 Posts: 9
|
Posted: Mon Jul 11, 2005 9:43 am Post subject: |
|
|
| That is much more correct and safe, I wish I wasn't so forgetful about type casting in c++ :( |
|
| Back to top |
|
 |
|