www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to load a derelict program in D?

reply "Jeroen Bollen" <jbinero gmail.com> writes:
I am using the derelict-sfml2 package in my code. My code:

import std.stdio;
import derelict.sfml2.window;

void main()
{
	DerelictSFML2Window.load();
	sfVideoMode videoMode = sfVideoMode(1280, 720);
	sfWindow* window = sfWindow_create(videoMode, "Animation", 
sfNone, null);
}

For some reason this always crashes inside a "void load( string 
libNames )" function. The crash seems to happen inside the 
'DerelictSFML2Window.load();'.

Why is that? I am using Visual Studio 2013, with the VisualD 
add-on. I have created the solution using "dub generate visuald"; 
this is my project.json:


{
	"name": "testing",
	"description": "testing",
	"authors": ["Jeroen Bollen"],
	"dependencies": {
		"derelict-sfml2" : "~master",
	}
}
Dec 06 2013
next sibling parent "Kelet" <kelethunter gmail.com> writes:
On Friday, 6 December 2013 at 19:50:52 UTC, Jeroen Bollen wrote:
 I am using the derelict-sfml2 package in my code. My code:

 import std.stdio;
 import derelict.sfml2.window;

 void main()
 {
 	DerelictSFML2Window.load();
 	sfVideoMode videoMode = sfVideoMode(1280, 720);
 	sfWindow* window = sfWindow_create(videoMode, "Animation", 
 sfNone, null);
 }

 For some reason this always crashes inside a "void load( string 
 libNames )" function. The crash seems to happen inside the 
 'DerelictSFML2Window.load();'.

 Why is that? I am using Visual Studio 2013, with the VisualD 
 add-on. I have created the solution using "dub generate 
 visuald"; this is my project.json:


 {
 	"name": "testing",
 	"description": "testing",
 	"authors": ["Jeroen Bollen"],
 	"dependencies": {
 		"derelict-sfml2" : "~master",
 	}
 }
Hello. I've used your package.json and source code in an attempt to replicate the problem, but could not. In this case, I'll still offer some "brute force" advice: 1. Ensure that CSFML >=2.0 dynamic libraries are in your PATH. Version 2.1 is working for me. 2. Make sure that the CSFML dynamic libraries are for the right architecture. I'm using the 32-bit Visual C++/GCC binaries (http://www.sfml-dev.org/download/csfml/CSFML-2.1-windows-32bits.zip). 3. Remove %APPDATA%\dub to get rid of possibly old packages and make sure your Dub is the latest version. 4. Try running it via dub rather than VisualD. i.e., "dub run" or "dub run --compiler=ldc2", etc.
Dec 06 2013
prev sibling parent "Mike Parker" <aldacron gmail.com> writes:
On Friday, 6 December 2013 at 19:50:52 UTC, Jeroen Bollen wrote:
 I am using the derelict-sfml2 package in my code. My code:

 import std.stdio;
 import derelict.sfml2.window;

 void main()
 {
 	DerelictSFML2Window.load();
 	sfVideoMode videoMode = sfVideoMode(1280, 720);
 	sfWindow* window = sfWindow_create(videoMode, "Animation", 
 sfNone, null);
 }

 For some reason this always crashes inside a "void load( string 
 libNames )" function. The crash seems to happen inside the 
 'DerelictSFML2Window.load();'.
Is it crashing or are you getting an exception? If the CSFML DLLs are not on your system path, then you'll get exceptions when trying to load them. Make sure the DLLs are in the app's working directory when you run it. Also, for Derelict-specific issues, it's probably better to post to the Derelict forums[1] rather than here. [1] http://dblog.aldacron.net/forum/index.php
Dec 06 2013