Closed joe-ju closed 10 months ago
I'm confident you've misdiagnosed what is happening here. Likely you've just missed a detail somewhere. Is it actually this example or is this a simplified version of the problem? If the latter, some things to double check:
static
?Unity does a lot of tricky stuff in the background, but it can't change the rules of C for you. If you've marked a variable as static in your release function, it's still static and Unity can't touch it.
Hi, thanks. My bad. I added the compilation macro "-Dstatic=" in my makefile, which means all static would be replaced with null.
Thanks a lot again!!
:) Awesome. That makes sense!
Hi, I implemented a test function in unity like: / tests / void test_helloworld(void) { target_fun(); target_fun(); }
And the target function implementation in my source is the following: void target_func(void) { static in i = 0; if (++i >=2) printf("hello world\n"); }
The print never happened and after some investigation, when target_fun() is invoked for the second time the "i" was reset to 0 again, but I also tested target_func(void) in the same way without unity and it worked. Do you have any idea about this test in unity? Thanks!