[julia-users] Is JL_GC_PUSH not allowed to be nested?

2016-09-10 Thread K leo
I tried to nest the GC pairs (JL_GC_PUSH, JL_GC_POP), but got some compile errors regarding julia.h. In file included from test6.cpp:11:0: > test6.cpp: In function ‘int main(int, char**)’: > /home/xxx/Software/julia-9c76c3e89a/include/julia/julia.h:609:19: error: > redeclaration of ‘void* __gc_s

Re: [julia-users] Is JL_GC_PUSH not allowed to be nested?

2016-09-10 Thread Yichao Yu
On Sat, Sep 10, 2016 at 8:37 PM, K leo wrote: > I tried to nest the GC pairs (JL_GC_PUSH, JL_GC_POP), but got some compile > errors regarding julia.h. > > In file included from test6.cpp:11:0: >> test6.cpp: In function ‘int main(int, char**)’: >> /home/xxx/Software/julia-9c76c3e89a/include/julia/

Re: [julia-users] Is JL_GC_PUSH not allowed to be nested?

2016-09-10 Thread K leo
Then how do we protect different objects that get allocated at different points in code? On Sunday, September 11, 2016 at 9:33:00 AM UTC+8, Yichao Yu wrote: > > > > No, there can only be one `JL_GC_PUSH` in a C scope (and the corresponding > `JL_GC_POP` must happen before the program exit from t

Re: [julia-users] Is JL_GC_PUSH not allowed to be nested?

2016-09-11 Thread Yichao Yu
On Sat, Sep 10, 2016 at 11:04 PM, K leo wrote: > Then how do we protect different objects that get allocated at different > points in code? > Have a large enough GC frame that covers them all. > > On Sunday, September 11, 2016 at 9:33:00 AM UTC+8, Yichao Yu wrote: >> >> >> >> No, there can onl

Re: [julia-users] Is JL_GC_PUSH not allowed to be nested?

2016-09-11 Thread Yichao Yu
> > Then how do we protect different objects that get allocated at different >> points in code? >> > > Have a large enough GC frame that covers them all. > Also note that the slots can be reused if the old value in the slot doesn't need to be kept alive anymore.