Looking for instructions on how to make a Derelict library
Mike Parker
aldacron at gmail.com
Mon Sep 18 00:21:23 UTC 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.
More information about the Digitalmars-d-learn
mailing list