THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/09/2012 at 11:20, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Well the main question is, is it safe to release the unoptimized compiled version for now so that the users can use the plugins in 64 bit without crashing while I try to figure out what's wrong with my code?
So, why does it only crash in Windows 64 bit? It works fine in Windows 7 32 bit with the optimization on, it works fine on Mac OS and it works fine in all other versions of Cinema 4D all the way back to R9.6. I'm using the same source code files for all versions, because I have them setup with preprocessor directives to check the API_VERSION.
The problem is that I'm not experienced enough to know where else to look. As I mentioned above I've gone through and initialized all uninitialized variables so that the compiler isn't giving me any warnings or errors. I've also put a breakpoint in the code so that I can step through it and check the values of the variables.
What are some other things for me to check? Is it possible that another one of my plugins could be overwriting code in the plugin that I'm debugging?
What 's different in 64 bit: The compiler can use more registers and does use less stack variables and therefore can do more optimizations. Most likely the 32 bit version contains the same bug and you'd been lucky that it hasn't popped up until now.
It's possible but not very likely that another plugin (or a - very rare - compiler bug) is causing this, but from experience I'd suggest investigating your plugin (single-stepping with the debugger/setting watch points) first.
What you might try is this tool (it's expensive if you plan buying it, but you can use the trial for without limitations of the functionality until you've "used" the a certain number of clicks on its output) : http://www.viva64.com/en/pvs-studio/
They do static code analysis of your source (which takes some time, if you haven't the fastest machine) and sometimes they are able to spot quite interesting bugs - you will also have to deal with false positives too (you've to check them all...), but that 's a part of static analysis.