On Friday, 17 June 2016 at 19:49:18 UTC, Johan Engelen wrote:
Hi all,
Is there another way to get access to Voldemort class methods, or private class members, other than using

Voldemort data is pretty well protected though. Because unlike protection attributes, modularizing stuff in functions actually means something.

I mean, D doesn't exactly make it easy. You can't normally define a function in a different file it's declared in. But if you use extern(C) to avoid mangling getObject, you can pretty much provide interface.d and secrets.o and without analyzing the binary machine code, there's no way to tell the size or nature of what getObject returns, aside from that it (claims) to have pointers to functions that match the interface.

interface.d:
interface Object { ... };
extern(C) Object getObject();

secrets.d:
class Vold : Object { ... };
extern(C) Object getObject() { ... return new Vold(...); ... }

secrets.o: ????

Because of the guarantee that you can link to opaque .o files, there's no general way to introspect into just what a function does, because that function might not have any source at all.

(I suppose you could instrument "new" itself in the raw runtime, to at least get the size of it. Assuming it wasn't malloc'd, or static...)

Reply via email to