escaping addresses of ref parameters - not

Christopher Wright dhasenan at gmail.com
Mon Feb 9 04:43:13 PST 2009


Daniel Keep wrote:
> I've used ref arguments in the past to wrap a C api that expects
> pointers.  I'm fine with this so long as there is a way to break out of
> it (in regular D, at least) that makes it abundantly clear you need to
> know what you're doing.
> 
> Something like:
> 
> void wrapSomeCApi(ref Foo arg)
> {
>     Foo* argptr = ref_unsafe_escape(arg);
>     some_c_api(argptr);
> }
> 
> Incidentally, I don't suppose we can get ref variables while Walter's at
> it? :P
> 
>   -- Daniel

Why aren't you passing a Foo*?



More information about the Digitalmars-d mailing list