On 1/29/23 13:45, Ruby the Roobster wrote:

> Of course, function pointers cannot be dereferenced.

Since you want to see the bytes, just cast it to ubyte*. The following function dumps its own bytes:

import std;

void main() {
    enum end = 0xc3;
    for (auto p = cast(ubyte*)&_Dmain; true; ++p) {
        writefln!" %02x"(*p);
        if (*p == end) {
            break;
        }
    }
}

(It can be written more elegantly as a range expression.)

> Furthermore, I would like to be able to do the same for an `asm` statement.

I don't know how to get the address of asm blocks.

Ali

Reply via email to