-->

Cocos2d-x and Marmalade - Troubles with CCCallFunc

2019-08-05 06:17发布

问题:

I have a working Cocos2d-x project, developed in XCode and based on the version cocos2d-1.0.1-x-0.13.0-beta

Now I have to make it work with Marmalade (using VS Express on a Windows pc), and I'm completely new to it. I managed to set up the project and the source code compiles just fine, but when I launch the project I get a cryptic exception when a CCCallFuncO is invocated:

DEFAULT: s3eDeviceHandleException: 1 0x00000000 0x00000000
Memory exception (11) attempting to access: 00000000
S3E runtime is not handling this exception
First-chance exception at 0x00000000 in s3e_simulator_debug.exe: 0xC0000005: Access violation.
Unhandled exception at 0x00000000 in s3e_simulator_debug.exe: 0xC0000005: Access violation reading location 0x00000000.

This occurres inside the class CCActionInstant, within the method CCCallFuncO::execute, on the instruction:

(m_pSelectorTarget->*m_pCallFuncO)(m_pObject);

As far as I can tell all the involved objects are correct and sound, proof is it totally works and makes sense with the very same code inside XCode and without Marmalade.

What is the difference between these two enviroment that could cause this issue? Any of you with Marmalade experience can give me a clue about what should I look for?

回答1:

I'm answering my own question just to let other developers know how I made this problem go away.

It turned out that the problem with the Marmalade simulator had nothing to do with the code. If you encounter a problem similar to mine - and by similar I mean you get a very unspecified exception when trying to run your app on the marmalade simulator - before trying anything else I can suggest you to remove the marmalade sub-folder and regenerate the project from the .mkb file. This apparently wipes away some cache and pre-compiled object which could be out of synch with your actual code. Removing the marmalade sub-folder forces the compiler to recreate all anew.