ImportC rocks!

Steven Schveighoffer schveiguy at gmail.com
Tue Mar 15 12:38:38 UTC 2022


On 3/15/22 5:42 AM, Andrea Fontana wrote:
> On Monday, 14 March 2022 at 17:49:23 UTC, Steven Schveighoffer wrote:
>> 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.
>>
> 
> I see you're using dstep to generate bindings. Do you know there's a 
> file with all  the exports? Did you try to generate bindings from it?
> 
> https://github.com/raysan5/raylib/blob/master/parser/raylib_api.json
> 
> (json is not the only format available, check that folder).

I did not know that, thanks for pointing it out! I'm going to stick with 
DStep for a few reasons:

1. Raylib's home-grown raylib-only header parser is probably not as 
mature as clang.
2. There isn't an already existing mechanism to parse these json files 
and produce D code. I'd have to write it.
3. Any tool that I write is useful for raylib, and nothing else.
4. Releases on raylib happen so infrequently, that the 30 minutes it 
takes for me to run dstep and the subsequent fixup is not a burden.

If ImportC gets to the point where you can truly import C headers, then 
I might switch to something like that.

-Steve


More information about the Digitalmars-d mailing list