Hi -

I think c_ptrTo(a_obj.value) ought to work. I think this is
a bug. Can file a bug report with a simple reproducer?

Thanks,

-michael

>Hi,
> 
>In Chapel, how can I pass a reference (c pointer style) to a field of a
>record/class to an external C function.
>
> 
>For example,
> 
>extern proc c_func(val_ptr: c_void_ptr);
> 
>class A {
>    type retType;
>    var value: retType;
>
>    // constructors not shown but they are the usual simple ones
>}
> 
>proc foo() {
>   var a_obj = A;
>   c_func(c_ptrTo(a_obj.value));
>
>   // codegen first creates a copy of a_obj and then passes pointer to
>the copy¹s value field.
>
>   // A a_obj_copy = a_obj; // copy by value
>   // c_func(&(c_obj_copy.value));
>   // But, I want the below:
>
>   // c_func(&(c_obj.value));
>}
> 
>Regards,
>Ashwin
> 
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to