-
Notifications
You must be signed in to change notification settings - Fork 35
Home
Derelict 3 is a collection of D dynamic bindings to several C libraries that are useful for creating multimedia applications, such as games. They are "dynamic bindings" because no static libraries, Windows DLL import libraries, or Posix shared libraries need be linked with an executable at compile time. Instead, Derelict provides a dynamic loader which loads shared libraries at runtime. This has several benefits.
This example shows how to use DerelictGLFW3, a binding to the GLFW 3 library.
// This import makes all of the GLFW 3 API available. It also exposes the
// GLFW 3 loader, DerelictGLFW3.
import derelict.glfw3.glfw3;
void main() {
// This call loads the library. A DerelictException will be thrown if
// the library fails to load.
DerelictGLFW3.load();
// Start using GLFW.
...
}
Each binding in Derelict follows this same format. Just import the proper module, call the load method on the specific loader, and the library is ready to use. With a few minor exceptions, the Derelict bindings match the C headers as closely as possible so that each library can be used as it is in C.
Dynamic loading of shared libraries avoids the hassle of dealing with object file format differences between compilers, allows hot swapping, and provides an opportunity to display an application-specific error message or take an alternative code path when a library fails to load. For those who find none of these benefits important, or who believe that dynamic bindings affect application startup time (something I've never seen in my own experience), then there are static bindings around the D community to several of the libraries which Derelict binds, and to others that you won't find in Derelict. Some of them can be found in the Deimos project. I encourage you to choose whichever binding you feel is right for you.
##Support
We all need a helping hand sometimes. For help with Derelict, please drop by the Derelict forums and ask. I try to check them on a daily basis and respond as promptly as I can. If you have any trouble getting through the security questions during forum registration, feel free to drop me a line at aldacron@gmail.com (GMail's spam filter is so good I don't worry about putting my addie out there anymore).
If you've found a bug in Derelict, or have discovered that one of the bindings is out of date, please report that on the issues page here at github rather than in the forum (or better yet, submit a pull request). If you aren't sure if you've found a bug or not, the forum is the place to go. So to reiterate, verified bugs and problems on the issues page, everything else to the forum. This will help me tremendously with keeping track of things.
Finally, if you are using Derelict on a regular basis you might what to follow my blog. I try to post semi-regularly about news and events in D-Land, but it's my primary spot for making Derelict-related announcements and other posts about the project. In fact, you could follow Planet D to keep up with my blog and several others about D. Several people have a lot of things to say about this wonderful programming language.
This Wiki is a work in progress. Over time, I hope to provide enough documentation and examples so that anyone coming to Derelict for the first time can get up and running quickly and easily. I've been delaying getting started on the documentation for quite a while, but I've noticed a couple of things lately that have caused me to reevaluate my priorities. One, the D community seems to be going through another growth spurt and I've had several new users asking for help with Derelict. And two, in the past couple of weeks three members of the D community have nudged me about improving the situation with the Derelict documentation. They're right!
Even if you are a long-time Derelict user, please check back often. As the wiki grows, there will be more resources to direct people to when they ask questions about Derelict in IRC or in the D newsgroups. If you have any ideas or suggestions about the wiki, I'm always open to them. Thanks!