I'm working with GCC compiled C libraries in an embedded environment, and as part of my development process I am testing the compiled libs in python. I'm compiling a .a lib for embedded use and a .dll lib for python. The idea of this part of development is to mirror the embedded C environment in python, as far as possible.
If a variable is not explicitly initialized in C code, it's value is not zero, but will be whatever is represented by the allocated RAM for that variable. This means that the behavior can be non-deterministic, which is why it's a good idea to always give variables an initial value.
In my "c-wrapped" python code implementation, I've found that the behavior differs from an embedded environment, and that un-initialized variables always default to zero. It would appear that when the lib is loaded in python, all of the RAM allocated to the lib is set to zero before any code is executed.
So, the questions:
- Is my understanding sound regarding the loading of a C lib in python, or am I missing something?
- What would be the best way to write random data to the allocated RAM, for the python implementation, after the lib is loaded?