BindBC codegen survey

IchorDev zxinsworld at gmail.com
Mon Aug 25 10:39:37 UTC 2025


On Saturday, 23 August 2025 at 20:53:47 UTC, Jordan Wilson wrote:
> 1. bindbc-allegro5, and bindbc-physfs

Unfortunately these are unofficial packages that I have no direct 
control over.

> 2. Haven't noticed any issues. Hmmm maybe optional parentheses 
> don't appear to be optionally anymore? I noticed this going 
> from `SiegeLord/DAllegro5` to `bindbc-allegro5`.

That would be because you are using dynamic bindings. 
`bindbc-allegro5` doesn't wrap its function pointers in a regular 
function (most official BindBC libraries do this now), and 
functions vs function pointers have incompatible call/reference 
syntax:
```d
int fn(){} //a function
int function() fnPtr; //a function pointer

int a1 = fn();
int a2 = fnPtr();

int b1 = fn;
int function() b2 = fnPtr;

int function() c1 = &fn;
int function()* c2 = &fnPtr;
```
`SiegeLord/DAllegro5` only has static bindings, but 
`bindbc-allegro5` defaults to using dynamic bindings. For most 
use-cases static bindings are simpler. Dynamic bindings are 
useful when you seriously need to re-link libraries at runtime 
(i.e. basically never), or want more control over 'missing 
library' error messages for a better end-user experience.


More information about the Digitalmars-d mailing list