Thread overview
Derelict
Dec 05, 2016
D.Rex
Dec 05, 2016
Mike Parker
Dec 05, 2016
D.Rex
Dec 05, 2016
Mike Parker
Dec 05, 2016
D.Rex
Dec 05, 2016
D.Rex
Dec 05, 2016
Chris Wright
Dec 06, 2016
D.Rex
December 05, 2016
Hi,

I am sure this has been asked a thousand times before, but can anyone link me to a tutorial on how to set up derelict and GLFW3, I am trying to work on a project and I just can't get it set up regardless of how many times I read the derelict readme's.

Also, if anyone knows of any good tutorials or ways of creating a flow-graph editor similar to blender's flow-graph editor interface I would greatly appreciate a link or some assistance, I have a rather large project I am working on which I would love to do in D and requires a flow-graph GUI much like blender's.

Cheers!
December 05, 2016
On Monday, 5 December 2016 at 11:38:05 UTC, D.Rex wrote:
> Hi,
>
> I am sure this has been asked a thousand times before, but can anyone link me to a tutorial on how to set up derelict and GLFW3, I am trying to work on a project and I just can't get it set up regardless of how many times I read the derelict readme's.

See the Derelict documentation (linked from the README) on using Derelict with DUB-managed projects [1]. Summary:

Step 1: Make sure the GLFW 3 library is installed on your system. On Windows, that means you just put the glfw3.dll in the same directory in which your executable will reside. On Mac, it's easiest to install with Homebrew (should be 'brew install glfw' or 'brew install glfw3', can't recall which). On Linux, use your package manager. Get the dev version of the package if you want, but you don't need it with Derelict.

Step 2: Add 'derelict-glfw3' as a dependency to your dub.json or dub.sdl file (assuming you are using dub to manage your project. If not, see the Derelict documentation using Derelict packages with non-DUB projects [2]).

For dub.json:
"dependencies" : {
"derelict-glfw3": "~>3.1.1"
}

For dub.sdl:

dependency "derelict-glfw3" version="~>3.1.1"

Step 3: Import derelict.glfw3.glfw3 and somewhere in your code, preferably during startup, call DerelictGLFW3.load.

```
import derelict.glfw3.glfw3;
void main() { DerelictGLFW3.load(); }
```

[1] http://derelictorg.github.io/building/with-dub/
[2] http://derelictorg.github.io/building/without-dub/



December 05, 2016
On Monday, 5 December 2016 at 13:54:01 UTC, Mike Parker wrote:
> On Monday, 5 December 2016 at 11:38:05 UTC, D.Rex wrote:
>> Hi,
>>
>> I am sure this has been asked a thousand times before, but can anyone link me to a tutorial on how to set up derelict and GLFW3, I am trying to work on a project and I just can't get it set up regardless of how many times I read the derelict readme's.
>
> See the Derelict documentation (linked from the README) on using Derelict with DUB-managed projects [1]. Summary:
>
> Step 1: Make sure the GLFW 3 library is installed on your system. On Windows, that means you just put the glfw3.dll in the same directory in which your executable will reside. On Mac, it's easiest to install with Homebrew (should be 'brew install glfw' or 'brew install glfw3', can't recall which). On Linux, use your package manager. Get the dev version of the package if you want, but you don't need it with Derelict.
>
> Step 2: Add 'derelict-glfw3' as a dependency to your dub.json or dub.sdl file (assuming you are using dub to manage your project. If not, see the Derelict documentation using Derelict packages with non-DUB projects [2]).
>
> For dub.json:
> "dependencies" : {
> "derelict-glfw3": "~>3.1.1"
> }
>
> For dub.sdl:
>
> dependency "derelict-glfw3" version="~>3.1.1"
>
> Step 3: Import derelict.glfw3.glfw3 and somewhere in your code, preferably during startup, call DerelictGLFW3.load.
>
> ```
> import derelict.glfw3.glfw3;
> void main() { DerelictGLFW3.load(); }
> ```
>
> [1] http://derelictorg.github.io/building/with-dub/
> [2] http://derelictorg.github.io/building/without-dub/

I have done as you have said here, I have glfw3.dll into the same directory as the executable, and included the dependencies in the dub.json file, however when I run my intialization code, it gives me the following error:

derelict.util.exception.SharedLibLoadException@src\derelict-util\source\derelict\util\exception.d(35): Failed to load one or more shared libraries:
	glfw3.dll - Access is denied.
----------------
0x004166B3 in void derelict.util.exception.SharedLibLoadException.throwNew(immutable(char)[][], immutable(char)[][]) at L:\dev\D\DEngine\src\derelict-util\source\derelict\util\exception.d(67)
0x0041BA52 in void derelict.util.sharedlib.SharedLib.load(immutable(char)[][]) at L:\dev\D\DEngine\src\derelict-util\source\derelict\util\sharedlib.d(144)
0x00416A78 in void derelict.util.loader.SharedLibLoader.load(immutable(char)[][]) at L:\dev\D\DEngine\src\derelict-util\source\derelict\util\loader.d(197)
0x004169C2 in void derelict.util.loader.SharedLibLoader.load(immutable(char)[]) at L:\dev\D\DEngine\src\derelict-util\source\derelict\util\loader.d(143)
0x004168B1 in void derelict.util.loader.SharedLibLoader.load() at L:\dev\D\DEngine\src\derelict-util\source\derelict\util\loader.d(83)
0x00402028 in _Dmain at L:\dev\D\DEngine\src\app.d(13)
0x0041C263 in D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv
0x0041C227 in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
0x0041C128 in _d_run_main
0x00403BA0 in main at L:\dev\D\DEngine\src\app.d(7)
0x00436AF5 in mainCRTStartup
0x73EF62C4 in BaseThreadInitThunk
0x77480719 in RtlSubscribeWnfStateChangeNotification
0x774806E4 in RtlSubscribeWnfStateChangeNotification

The code I have that runs derelictGLFW3.load() etc is as follows:

import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;

int main()
{
	DerelictGL3.load();
	DerelictGLFW3.load();
	
	GLFWwindow* window;
	
	if(!glfwInit())
	{
		return -1;
	}
	
	window = glfwCreateWindow(1280,720, "D OpenGL Engine", null, null);
	if(!window)
	{
		glfwTerminate();
		return -1;
	}
	
	/* make window' context current */
	glfwMakeContextCurrent(window);
	DerelictGL3.reload();
	
	while(!glfwWindowShouldClose(window))
	{
		glfwSwapBuffers(window);
		glfwPollEvents();
	}
	
	glfwTerminate();
	return 0;
}
December 05, 2016
On Monday, 5 December 2016 at 14:40:46 UTC, D.Rex wrote:

> I have done as you have said here, I have glfw3.dll into the same directory as the executable, and included the dependencies in the dub.json file, however when I run my intialization code, it gives me the following error:
>
> derelict.util.exception.SharedLibLoadException@src\derelict-util\source\derelict\util\exception.d(35): Failed to load one or more shared libraries:
> 	glfw3.dll - Access is denied.

OK, this has nothing to do with your code or with Derelict. When you get a SharedLibLoadException, the message it contains comes from the system. In this case, it's the bit that says 'Access is denied'. I've never encountered that while loading libraries on Windows. It looks like something to do with file permissions, but I really have no idea. You'll need to consult Google to find out what it means to get that message in conjunction with LoadLibrary (which is what Derelict is using internally).
December 05, 2016
On Monday, 5 December 2016 at 14:53:53 UTC, Mike Parker wrote:
> On Monday, 5 December 2016 at 14:40:46 UTC, D.Rex wrote:
>
>
> OK, this has nothing to do with your code or with Derelict. When you get a SharedLibLoadException, the message it contains comes from the system. In this case, it's the bit that says 'Access is denied'. I've never encountered that while loading libraries on Windows. It looks like something to do with file permissions, but I really have no idea. You'll need to consult Google to find out what it means to get that message in conjunction with LoadLibrary (which is what Derelict is using internally).

On Monday, 5 December 2016 at 14:53:53 UTC, Mike Parker wrote:

Thanks for the help anyways, I shall look into this.  Are you the creator of Derelict?  If so do you have an e-mail or something similar I can contact you on regarding my project? it is heavily involved with D and OpenGL and I would be really interested in your opinion.
December 05, 2016
On Monday, 5 December 2016 at 15:00:23 UTC, D.Rex wrote:
> On Monday, 5 December 2016 at 14:53:53 UTC, Mike Parker wrote:

>
> On Monday, 5 December 2016 at 14:53:53 UTC, Mike Parker wrote:
>
> Thanks for the help anyways, I shall look into this.  Are you the creator of Derelict?  If so do you have an e-mail or something similar I can contact you on regarding my project? it is heavily involved with D and OpenGL and I would be really interested in your opinion.

Actually, I think I may know the problem with the access denied bit, it's too late for me to test now but I will test tomorrow.  My D source code and the GLFW3.dll library are stored on a Linux file server (I am using D in Eclipse on a Windows 10 machine), so perhaps there is some issue with the FileServer denying access to certain things, so I will investigate if moving the source and the dll to my local machine will remove this issue, I will post here the results.
December 05, 2016
On Mon, 05 Dec 2016 15:46:44 +0000, D.Rex wrote:
> My D source
> code and the GLFW3.dll library are stored on a Linux file server

Do DLLs have to be marked executable? I seem to recall something like that.
December 06, 2016
On Monday, 5 December 2016 at 22:36:25 UTC, Chris Wright wrote:
> On Mon, 05 Dec 2016 15:46:44 +0000, D.Rex wrote:
>
> Do DLLs have to be marked executable? I seem to recall something like that.

Okay, so I moved my source code and the glfw3 dll to my local machine and lo and behold it worked, so I gather the 'access denied' problem I was having before was an issue regarding permissions on the FileServer side.  I should probably make note of that somewhere...