Initialization to 0 for _varg is OK, of course.

What does camlidl_acquire_runtime do ? I couldn't find it in camlidl
sources. Is-it possible it could trigger some garbage collection ? Is
the field this->caml_object protected from a GC move during
camlidl_acquire_runtime() ?

Fabrice

On 07/01/2011 02:54 PM, Dmitry Bely wrote:
> On Fri, Jul 1, 2011 at 3:56 PM, Fabrice Le Fessant
> <[email protected]> wrote:
>> I would not call camlidl_alloc_small() without first initializing
>> correctly _varg[1] to Val_unit.
> 
> Actually, it's initialized to zero. The full generated fragment:
> 
> HRESULT STDMETHODCALLTYPE camlidl_ppm_IConfigLoad_setLogger_callback(
>       struct IConfigLoad * this,
>       /* in */ void *log)
> {
>   value _varg[2] = { 0, 0, };
>   value _vres;
>   HRESULT _res;
>   (*camlidl_acquire_runtime)();
>   Begin_roots_block(_varg, 2)
>     _varg[0] = ((struct camlidl_intf *) this)->caml_object;
>     _varg[1] = camlidl_alloc_small(1, Abstract_tag);
>     Field(_varg[1], 0) = (value) log;
>   End_roots()
>   _vres = caml_callbackN_exn(caml_get_public_method(_varg[0],
> Val_int(1007700946)), 2, _varg);
>   if (Is_exception_result(_vres)) {
>     _res = camlidl_result_exception(NULL, Extract_exception(_vres));
>   } else {
>     _res = S_OK;
>   }
>   (*camlidl_release_runtime)();
>   return _res;
> }
> 
> It was Xavier Leroy who initially decided to use zeroes, so I think it's OK?
> 
> - Dmitry Bely
> 

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

<<attachment: fabrice_le_fessant.vcf>>

Reply via email to