Thread overview
Looking for instructions on how to make a Derelict library
Sep 17, 2017
Matt Jones
Sep 18, 2017
Mike Parker
Sep 18, 2017
Matt Jones
Sep 18, 2017
jmh530
Sep 18, 2017
Mike Parker
Sep 18, 2017
SrMordred
Sep 18, 2017
Matt Jones
September 17, 2017
Hey everyone,

I wanted to make a version of SQlite3 that uses Derelict to load the sqlite3 DLL when I'm ready. I can't find any instructions for how to make a basic Derelict style library. I looked around at http://derelictorg.github.io/, but could not find anything. Does anyone have any?

Thanks.
September 18, 2017
On Sunday, 17 September 2017 at 21:15:08 UTC, Matt Jones wrote:
> Hey everyone,
>
> I wanted to make a version of SQlite3 that uses Derelict to load the sqlite3 DLL when I'm ready. I can't find any instructions for how to make a basic Derelict style library. I looked around at http://derelictorg.github.io/, but could not find anything. Does anyone have any?
>
> Thanks.

Just look at the existing Derelict packages. For a normal C library like sqlite3, it's pretty straightforward -- declare function pointers to ever public function in the API, translate all the types, convert any macros to D functions, and create a loader that extends derelict.util.SharedLibLoader and overrides loadSymbols. Examples: DerelictLua, DerelictODE, DerelictFT.

You can also add support for static bindings by versioning out the function declarations and the loader in favor or normal function declarations. Examples: DerelictSDL2, DerelictGLFW3, DerelictAL.

See the D wiki for links to articles that show how to translate C headers.
September 18, 2017
On Monday, 18 September 2017 at 00:21:23 UTC, Mike Parker wrote:

>
> See the D wiki for links to articles that show how to translate C headers.



I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too.

Thanks.
September 18, 2017
On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote:
>
>
>
> I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too.
>
> Thanks.

Might be interesting to write up your experience with doing it as either blog post or part of the Derelict documentation (which is already quite good, IMO).
September 18, 2017
On Monday, 18 September 2017 at 11:27:01 UTC, jmh530 wrote:
> On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote:
>>
>>
>>
>> I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too.
>>
>> Thanks.
>
> Might be interesting to write up your experience with doing it as either blog post or part of the Derelict documentation (which is already quite good, IMO).

I used to have a guide to creating "Derelictified" bindings for an older version. I should write one up for the current version.
September 18, 2017
> I used to have a guide to creating "Derelictified" bindings for an older version. I should write one up for the current version.

+1
September 18, 2017
On Monday, 18 September 2017 at 11:27:01 UTC, jmh530 wrote:
> On Monday, 18 September 2017 at 00:33:25 UTC, Matt Jones wrote:
>>
>>
>>
>> I've been reading the DerelictSDL2 source code. I think I have a handle on it. I'll have to look more at the wiki too.
>>
>> Thanks.
>
> Might be interesting to write up your experience with doing it as either blog post or part of the Derelict documentation (which is already quite good, IMO).

I was thinking of doing that. I'll have to figure out the best way to do that, once I get a better understanding of how Derelict works.