• Advertisement

Archived

This topic is now archived and is closed to further replies.

PR_SetEmitterCollisionProc

This topic is 6554 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am writing a dll in order to be able to use PR from another programming language, Dolphin Smalltalk. After having added most of the functions I am now experimenting with the the callback functions such as PR_SetEmitterCollisionProc. Since it isn''t possible to call functions in Smalltalk from the dll I am instead using WM_COPYDATA to send the argument, for example an PR_EMITTER in this case. This code looks like this: // Callback functions. void SendEmitterCollision (PR_EMITTER *emit) { COPYDATASTRUCT cds; cds.lpData = emit; cds.cbData = sizeof(PR_EMITTER); cds.dwData = EMITTER_COLLISION; SendMessage(WindowHandle, WM_COPYDATA, 0, (LPARAM)&cds); } Then I use PR_SetEmitterCollisionProc to point to this function. In the examples (example number twelve) this is done like this: PR_SetEmitterCollisionProc (BOUNCEPUFF_EMITTER, BouncePuffCollide); when BouncePuffCollide is defined like this: void BouncePuffCollide (PR_EMITTER *emit) And therefore I thought that I could simply write: extern "C" __declspec( dllexport ) DLL_SetEmitterCollisionProc (PR_DWORD emitnum) { PR_SetEmitterCollisionProc (emitnum, SendEmitterCollision); } And then call DLL_SetEmitterCollisionProc once for each emitter in order to initialize, since they are all using the same function, but the MSVC 6.0 compiler doesn''t accept this. It gives the following error: error C2664: ''PR_SetEmitterCollisionProc'' : cannot convert parameter 2 from ''void (PR_EMITTER *)'' to ''void (__cdecl *)(void *)'' Why am I not allowed to do it like this when the example code is almost identical to my code? PR_SetEmitterCollisionProc is defined like this: void PR_SetEmitterCollisionProc (PR_DWORD emitnum, void (*collideproc) (void *emit)) I would very much appreciate any help on how to make this work. Thanks in advance /Micke

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement