Re: Difficulties with C FFI & writing a concurrent stack

2019-11-19 Thread Vanessa McHale
Oh, you're right! I can get the demo working now :) Thanks again, Vanessa On Monday, November 18, 2019 at 11:25:12 PM UTC-6, gmhwxi wrote: > > Took a closer look. > > 'atstype_var' should be changed to 'atstype_boxed'. > > The real problem is due to 'pop' being given an incorrect type. > I tried

Re: Difficulties with C FFI & writing a concurrent stack

2019-11-18 Thread Hongwei Xi
Took a closer look. 'atstype_var' should be changed to 'atstype_boxed'. The real problem is due to 'pop' being given an incorrect type. I tried the following type to make the code work: extern fun pop {a:type}(_t(a) >> _) : (a) = "ext#pop_ats" To mix C with ATS can be difficult. In

Re: Difficulties with C FFI & writing a concurrent stack

2019-11-18 Thread Vanessa McHale
Thanks for the response! Unfortunately I still get trouble, viz. ... atstype_boxed pop_ats(atstype_ref st) { return __cats_pop(st); } atsvoid_t0ype new_ats(atstype_ref st) { __cats_new(st); } atsvoid_t0ype push_ats(atstype_ref st, atstype_boxed val) { __cats_push(st, val); } %} typedef

Re: Difficulties with C FFI & writing a concurrent stack

2019-11-17 Thread gmhwxi
Each occurrence of {a:t@ype+} should be changed to {a:type}. E.g., extern fun pop {a:t@ype+}(_t(a) >> _) : Option(a) = "ext#pop_ats" should be changed to extern fun pop {a:type}(_t(a) >> _) : Option(a) = "ext#pop_ats" On Sunday, November 17, 2019 at 10:16:11 PM UTC-5, Vanessa McHale wrote: