Can't assign extern(C) function pointer to D variable?
Hipreme
msnmancini at hotmail.com
Tue Nov 22 21:32:43 UTC 2022
On Tuesday, 22 November 2022 at 21:11:37 UTC, XavierAP wrote:
> I was surprised when it didn't compile, though I immediately
> found it understandable...
> Already read through https://dlang.org/spec/interfaceToC.html
> and https://wiki.dlang.org/Bind_D_to_C
>
> [...]
You need to create an alias containing your callback type.
```d
alias DCallback = extern(C) void function();
DCallback cb;
cb = yourCFunction;
```
More information about the Digitalmars-d-learn
mailing list