www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Basic DerelictOrg and Deimos question

reply "WhatMeWorry" <kheaser gmail.com> writes:
within DerelictOrg, I've used DerelictGL3 and DerelictGLFW3 
packages successfully. But just today I stumbled across 
D-Programming-Deimos and noticed that it has a glfw and an OpenGL 
as well.

I've read some of the descriptions and Derelict talks about 
"dynamic bindings" where Deimos mentions "D interfaces".

Just for clarity's sake, should I consider the DerelictOrg and 
Deimos (packages, projects, or libraries) as separate from one 
another?  Or does DerelictOrg use Deimos behind the scenes?
Oct 24 2014
parent reply Justin Whear <justin economicmodeling.com> writes:
On Fri, 24 Oct 2014 18:04:13 +0000, WhatMeWorry wrote:
 
 Just for clarity's sake, should I consider the DerelictOrg and Deimos
 (packages, projects, or libraries) as separate from one another?  Or
 does DerelictOrg use Deimos behind the scenes?
They are quite different. The Deimos packages are static bindings to the C libraries--requiring you to statically link. This, incidentally is why there is no Deimos binding for OpenGL: it cannot be statically linked (unless you go with a software implementation like MESA) because libGL is provided by the end user's video hardware drivers. If you're writing games or similar that you want to distribute, definitely go with the dynamic bindings that Derelict provides. It allows the end-user to use whatever version they already have installed.
Oct 24 2014
parent "Mike Parker" <aldacron gmail.com> writes:
On Friday, 24 October 2014 at 18:16:52 UTC, Justin Whear wrote:
 On Fri, 24 Oct 2014 18:04:13 +0000, WhatMeWorry wrote:
 
 Just for clarity's sake, should I consider the DerelictOrg and 
 Deimos
 (packages, projects, or libraries) as separate from one 
 another?  Or
 does DerelictOrg use Deimos behind the scenes?
They are quite different. The Deimos packages are static bindings to the C libraries--requiring you to statically link. This, incidentally is why there is no Deimos binding for OpenGL: it cannot be statically linked (unless you go with a software implementation like MESA) because libGL is provided by the end user's video hardware drivers.
To clarify a bit for the OP, I should point out that this isn't actually correct. To get the terminology straight, there are two types of linking. Static linking means linking with a static library. Dynamic linking means linking with an import library on Windows or directly with a .so on Posix systems. Static bindings support both types, so Deimos does not preclude you from using shared libraries. It just always has a link-time dependency. Dynamic bindings have no link-time dependencies at all. They cannot be linked with either static or shared libraries (because the external functions are actually function pointers). Instead, they use a process called 'dynamic loading' to pull the shared library into the process space at run time. When I first came to D over 10 years ago, the only OpenGL binding out there was a static one. It's quite possible to link with the OpenGL shared library to get whatever the system provides and then pull in later versions at run time. For example, on Windows you could get 1.1 by linking (IIRC up to 1.4 since Vista or maybe Win 7), but had to load the rest at run time. Of course, OGL is a special case.
Oct 24 2014