Class instance becoming null after calling bindings to C code???

Adam D. Ruppe destructionator at gmail.com
Wed Nov 15 13:30:14 UTC 2017


On Wednesday, 15 November 2017 at 13:24:02 UTC, Chirs Forest 
wrote:
> class Audio {
> Audio a;
>     writeln(&a); // 281478

&class is usually wrong. That's the address of the reference, not 
of the actual object. You might want `cast(void*) a` instead to 
print the address of the object itself.

>     writeln(&a); // null

Though why it would ever say null is weird. Maybe one of the 
lengths you pass to a C function is wrong and it is writing too 
far and killing one of the hidden thread local pointer variables.



More information about the Digitalmars-d-learn mailing list