ImportC rocks!

Steven Schveighoffer schveiguy at gmail.com
Mon Mar 14 18:11:09 UTC 2022


On 3/14/22 2:02 PM, jmh530 wrote:
> On Monday, 14 March 2022 at 17:49:23 UTC, Steven Schveighoffer wrote:
>> [snip]
>>
>> One thing that is very obvious from a few of my PRs is that raylib is 
>> not interested in making changes specifically to be binding-friendly. 
>> I think you will probably find this from many C libraries -- their 
>> focus is their library, not yours. If ImportC cannot work with C 
>> libraries as they stand without "simple tweaks", then it's just not 
>> going to be worth much.
>>
> 
> Would there be any benefit to having raylib-d take advantage of importC, 
> rather than the user, but also keep around some of the things that make 
> it easier to use, like the Colors enum?

ImportC could replace much of the binding, sure. However, we have an 
additional problem in that raylib-d adds things to structs, such as 
operator overloads. That's not so easy to do.

ImportC itself is great for things that you want to "just use". Again, 
though, it needs to provide some mechanism to access #define constants 
and macros.

But as a D developer, using an actual C library gets quite annoying. You 
deal with it because it's what's available. But if I can add niceties to 
it, I'd rather do that.

Raylib itself is such a simple and well-organized library that I've 
contemplated just rewriting it in D with a D-like interface (use 
strings, use overloading, operator overloads, etc). But contemplation is 
all I have time for unfortunately :(

-Steve


More information about the Digitalmars-d mailing list