views:

42

answers:

0

I'm using Boost.Python to expose JRA's BWRepLib so I can try to do some data mining on sc:bw replays in python and I've run into a small problem with the values being returned from the C++ methods. When running any old simple program such as the tutorial I get the expected value returned to python (a "hello, world" string that prints out fine). However when I run the bwreplib program I run into the problem where all the strings get truncated and certain integer returning methods return unexpected values. For example in one replay the player names in C++ return properly as player 1 being SlayerS_'BoxeR', player 2 as iloveoov. However the values printed out in python are erS_'Boxer' and eoov, missing the initial 4 bytes/chars. Another example is the player race which should be an integer value 1,2,3 or 6, however I'm getting larger unrelated values such as 97, 120, 111, and 78 however certain values such as 120 and 97 should be the same race and return the same value from in the pure C++ program. As I see no binary correlation between the numbers I suspect that perhaps this is being offset by a word in python as well and returning a value from a different location? Has anyone encountered a similar problem?

I'm pretty new at using Boost.Python and not a C++ expert. I can post the wrapper however it doesn't do much other than expose the functions such as

class_<BWrepPlayer>("BWrepPlayer")
.def("getName", &BWrepPlayer::getName)
.def("getNumber", &BWrepPlayer::getNumber)

I suspect I am supposed to do something special to wrap the functions that I am not doing. However searching online and reading through the documentation I can not find what that would be, however I'm sure it will be glaringly obvious once I find out.

Edit: Log Output

...patience...
...patience...
...found 1547 targets...
...updating 4 targets...
compile-c-c++ bin\msvc-9.0\debug\threading-multi\BWrepAPI.obj
BWrepAPI.cpp
BWrepAPI.cpp(19) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(74) : see declaration of 'strcpy'
BWrepAPI.cpp(88) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(74) : see declaration of 'strcpy'
BWrepAPI.cpp(245) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(74) : see declaration of 'strcpy'
BWrepAPI.cpp(246) : warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(79) : see declaration of 'strcat'
BWrepAPI.cpp(259) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(74) : see declaration of 'strcpy'
BWrepAPI.cpp(265) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(74) : see declaration of 'strcpy'
BWrepAPI.cpp(277) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\string.h(74) : see declaration of 'strcpy'
BWrepAPI.cpp(323) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        c:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\stdio.h(237) : see declaration of 'fopen'
msvc.link.dll bin\msvc-9.0\debug\threading-multi\pybwrep.pyd
   Creating library bin\msvc-9.0\debug\threading-multi\pybwrep.lib and object bin\msvc-9.0\debug\threading-multi\pybwrep.exp
msvc.manifest.dll bin\msvc-9.0\debug\threading-multi\pybwrep.pyd
...updated 4 targets...