Boost logo

Boost Users :

From: Arun Dharankar (ADharankar_at_[hidden])
Date: 2006-03-03 05:25:50


Hello,

The answer which Peter Dimov provided
(http://lists.boost.org/boost-users/2006/03/17717.php) is correct, at
least the way I wanted it to. Also, Valgrind does not complain any more
with the change Peter Dimov suggested.

Thanks for responding!

Best regards,
-Arun.

-------- Original Message --------
From: Sebastian Redl <sebastian.redl_at_[hidden]>
To: boost-users_at_[hidden]
Subject: Re:[Boost-users] Assigning smart/shared_ptr pointer to C struct
Date: 3/3/2006 02:57
> adharankar_at_[hidden] wrote:
>
>
>> What is wrong in assigning a smart/shared_ptr pointer in C++ code to a struct which may then be passed to a C code?
>>
>>
>>
> There is no safe way to pass any non-POD type to C code. In your
> example, this means both the shared_ptr object and the pointed-to A object.
> You need to ensure the lifetime of the pointer manually, and you need to
> extract the raw pointer and pass that to the C code. You also need to
> make it point to a POD type.
>
> Sebastian Redl
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net