escaping addresses of ref parameters - not

Daniel Keep daniel.keep.lists at gmail.com
Sun Feb 8 23:32:03 PST 2009


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



More information about the Digitalmars-d mailing list