Passing myself, a struct, as a C callback context
Paul O'Neil via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Mar 29 19:53:35 PDT 2015
I'm registering a callback with some C code. The simplified story is
here, but the actual code is on GitHub [1] at the end if you care.
The call looks something like this.
void register(void(*fp)(void*), void* context);
I have a class that holds state for the callback and registers itself:
final class Klass
{
void method()
{
register(callback_function, &this);
}
}
As of dmd 2.067, doing "&this" is deprecated. Is there an idiomatic way
to do this?
[0] Actual code is at
https://github.com/todayman/dubik/blob/master/source/vibe/core/drivers/rx.d#L177
. The msg object eventually gets passed to the registration function.
Thanks,
--
Paul O'Neil
Github / IRC: todayman
More information about the Digitalmars-d-learn
mailing list