On Tuesday, 24 May 2022 at 22:18:44 UTC, Adam D Ruppe wrote:

There's a big difference between a function and a function pointer.

Could you please clarify in this context?

`Fun` is basically generated by code like that:
```d
extern (Windows) void* GetProcAddress(void*, const char*);
auto fn = cast(T)GetProcAddress(lib, mangledName.toStringz);
```

If it is a function, you get its address with the & operator. But if it is supposed to be a function pointer, something is wrong with the declaration...

I have no idea what the correct term is but the debugger says `fun` is:
(if that `assert()` is removed and it compiles):
```
Type: void function(...)*
Value: 0x0000000000000000  null
```

I can get some address with `&fun` but deferencing then fails:
```d
auto addr = &fun;
assert(*addr); // Error: expression `*addr` of type `extern (C) void(...)` does not have a boolean value
```

Reply via email to