Re: Explicitly Freeing Memory
Unfortunately I don't have any good suggestions... I have been avoiding depending on dtors in D because of the aforementioned issues (and more), so I haven't had much experience in debugging dtor-related problems in D. I decided to just free everything explicitly: https://github.com/maximecb/Higgs/blob/03931178deb5794bf27b1020542d102a08286c07/source/runtime/vm.d#L784 It seems to address my memory leak issue for the moment: `make test` uses about 1/3 the memory and runs more than twice as fast.
Dub / Derelict confusion
I would like to create a simple program using SDL. I've read this page http://dblog.aldacron.net/derelict-help/using-derelict/ and this one http://code.dlang.org/about and decided that using 'dub' would be the sensible option for a beginner so I downloaded the dub executable and put it in the same directory as my source file 'test.d'. As per the example at the above url, I created a dub.json file in the same directory with contents as so: dependencies: { derelict-sdl2:~1.0.0, derelict-gl3:~master, } If I have the relevant import statements in test.d, am I right in thinking I can use dub to build my program (not just download and build the derelict libraries)? The command dub build test.d gives me a 'failed to load package' error. I'm using 32 bit Linux. Any help appreciated :D Paul
Re: Dub / Derelict confusion
On Wednesday, 19 November 2014 at 09:12:52 UTC, Paul wrote: I would like to create a simple program using SDL. I've read this page http://dblog.aldacron.net/derelict-help/using-derelict/ and this one http://code.dlang.org/about and decided that using 'dub' would be the sensible option for a beginner so I downloaded the dub executable and put it in the same directory as my source file 'test.d'. As per the example at the above url, I created a dub.json file in the same directory with contents as so: dependencies: { derelict-sdl2:~1.0.0, derelict-gl3:~master, } If I have the relevant import statements in test.d, am I right in thinking I can use dub to build my program (not just download and build the derelict libraries)? The command dub build test.d gives me a 'failed to load package' error. I'm using 32 bit Linux. Any help appreciated :D Paul Dub will download and build the D packages from code.dlang.org. However, some D packages require you to download compiled libraries they link to for your syste. (or build them yourself from source) For sdl2 on linux, you need to go to: https://www.libsdl.org/download-2.0.php and download the source. Compile those libs using ($ ./configure; make; make install;) Put them into a place your linker can find (usually /usr/lib/ iirc). I believe that should work for you!
Re: Explicitly Freeing Memory
You can control it by creating a global flag and checking it before freeing.
Re: Dub / Derelict confusion
On Wednesday, 19 November 2014 at 09:12:52 UTC, Paul wrote: I would like to create a simple program using SDL. I've read this page http://dblog.aldacron.net/derelict-help/using-derelict/ and this one http://code.dlang.org/about and decided that using 'dub' would be the sensible option for a beginner so I downloaded the dub executable and put it in the same directory as my source file 'test.d'. As per the example at the above url, I created a dub.json file in the same directory with contents as so: dependencies: { derelict-sdl2:~1.0.0, derelict-gl3:~master, } If I have the relevant import statements in test.d, am I right in thinking I can use dub to build my program (not just download and build the derelict libraries)? The command dub build test.d gives me a 'failed to load package' error. I'm using 32 bit Linux. Any help appreciated :D Paul could you give some more details? Full package.json, the file-structure of your project and the full output from dub would help.
Re: Dub / Derelict confusion
On 11/19/2014 6:12 PM, Paul wrote: I would like to create a simple program using SDL. I've read this page http://dblog.aldacron.net/derelict-help/using-derelict/ and this one http://code.dlang.org/about and decided that using 'dub' would be the sensible option for a beginner so I downloaded the dub executable and put it in the same directory as my source file 'test.d'. It doesn't need to be in the same directory as the source. Put it somewhere on the global path. As per the example at the above url, I created a dub.json file in the same directory with contents as so: dependencies: { derelict-sdl2:~1.0.0, derelict-gl3:~master, } You shouldn't be depending on ~master for anything anymore. The newest version of dub will complain about dependencies on git branches. For derelict-gl3, you can use =1.0.0. If I have the relevant import statements in test.d, am I right in thinking I can use dub to build my program (not just download and build the derelict libraries)? Yes, assuming that your dub.json is properly configured. The command dub build test.d gives me a 'failed to load package' error. That's the right command, but the wrong parameters. If you are going to pass a parameter to the build command, it should be the name of a dub package, not the name of a file. Typically, you don't need to pass it a package name if all is properly configured. Try this: 1 -- make sure dub is on the global path. 2 -- mkdir dubtest cd dubtest dub init You should see the following output in side the dubtest dir -dub.json ---source -app.d 3 -- Edit dub.json and add the following dependencies: derelict-sdl2:~1.0.0, derelict-gl3:=1.0.0 4 -- Edit app.d to look like this: import derelict.opengl3.gl3, derelict.sdl2.sdl; void main() { DerelictGL3.load(); DerelictSDL2.load(); import std.stdio : writeln; writeln( Success!); } 5-- Execute the following command: dub You'll see some messages about fetching and building the Derelict packages and then, assuming you have SDL2 and OpenGL on your system library search path, you should see it print Success!. Otherwise, you'll get a DerelictException of one kind or another. Note that I didn't give dub a command option. Executing 'dub' with no options will cause it to build and run whatever package is in the current directory. By default, dub will look for source/app.d if you don't configure something differently in dub.json. Executing 'dub build' will build the executable, but will not run it.
Re: Dub / Derelict confusion
Put them into a place your linker can find (usually /usr/lib/ iirc). I forgot, I'm pretty sure make install does that step for you.
Re: Dub / Derelict confusion
@wobbles: Sorry, should have said, I built SDL and the libraries are installed in /usr/local/lib could you give some more details? Full package.json, the file-structure of your project and the full output from dub would help. @John Colvin The entire contents of dub.json are as above. My program is a single file just to check that I can init SDL: import std.stdio; import derelict.sdl2.sdl; void main(){ // Load the SDL 2 library. DerelictSDL2.load(); //init SDL . } The error is: Error executing command build: Failed to load package at /home/paul/D-programs/: Expected end of string after JSON value, not ': { derelict-sdl2:~1.0.0, derelict-gl3:~master, }'. TIA
Re: Simple timing
On Monday, 17 November 2014 at 16:38:45 UTC, Rene Zwanenburg wrote: Clock.currTime uses a high performance timer, QueryPerformanceCounter on Windows for example, so you shouldn't have to worry about timer accuracy. You probably mistake it for StopWatch, clock is not timer.
Re: Debugging on OSX
On 27/09/2014 16:21, Phil wrote: I've seen a few old threads mentioning this, but couldn't find anything more recent. What support is there for debugging on OSX? I'm currently trying MonoD, but the option to run with debugger is greyed out. Have you checked: http://wiki.dlang.org/Debuggers ? That should list the info you are looking for. In particular, have you tried DDT? It has GDB integration (and possibly LLDB too, although I haven't tried that yet) -- Bruno Medeiros https://twitter.com/brunodomedeiros
Re: Dub / Derelict confusion
On Wednesday, 19 November 2014 at 10:09:55 UTC, Paul wrote: @wobbles: Sorry, should have said, I built SDL and the libraries are installed in /usr/local/lib could you give some more details? Full package.json, the file-structure of your project and the full output from dub would help. @John Colvin The entire contents of dub.json are as above. My program is a single file just to check that I can init SDL: import std.stdio; import derelict.sdl2.sdl; void main(){ // Load the SDL 2 library. DerelictSDL2.load(); //init SDL . } The error is: Error executing command build: Failed to load package at /home/paul/D-programs/: Expected end of string after JSON value, not ': { derelict-sdl2:~1.0.0, derelict-gl3:~master, }'. TIA your dub.json is invalid. Please see http://code.dlang.org/package-format I'm not sure what the exact requirements are for a minimal dub.json, but you should at very least have a name. Also, watch out for where your source files are: dub expects them in a source/ or src/ folder by default, you can change this by setting sourcePaths in your dub.json
Re: Dub / Derelict confusion
On Wednesday, 19 November 2014 at 10:07:56 UTC, Mike Parker wrote: On 11/19/2014 6:12 PM, Paul wrote: I would like to create a simple program using SDL. I've read this page http://dblog.aldacron.net/derelict-help/using-derelict/ and this one http://code.dlang.org/about and decided that using 'dub' would be the sensible option for a beginner so I downloaded the dub executable and put it in the same directory as my source file 'test.d'. It doesn't need to be in the same directory as the source. Put it somewhere on the global path. As per the example at the above url, I created a dub.json file in the same directory with contents as so: dependencies: { derelict-sdl2:~1.0.0, derelict-gl3:~master, } You shouldn't be depending on ~master for anything anymore. The newest version of dub will complain about dependencies on git branches. For derelict-gl3, you can use =1.0.0. If I have the relevant import statements in test.d, am I right in thinking I can use dub to build my program (not just download and build the derelict libraries)? Yes, assuming that your dub.json is properly configured. The command dub build test.d gives me a 'failed to load package' error. That's the right command, but the wrong parameters. If you are going to pass a parameter to the build command, it should be the name of a dub package, not the name of a file. Typically, you don't need to pass it a package name if all is properly configured. Try this: 1 -- make sure dub is on the global path. 2 -- mkdir dubtest cd dubtest dub init You should see the following output in side the dubtest dir -dub.json ---source -app.d 3 -- Edit dub.json and add the following dependencies: derelict-sdl2:~1.0.0, derelict-gl3:=1.0.0 4 -- Edit app.d to look like this: import derelict.opengl3.gl3, derelict.sdl2.sdl; void main() { DerelictGL3.load(); DerelictSDL2.load(); import std.stdio : writeln; writeln( Success!); } 5-- Execute the following command: dub You'll see some messages about fetching and building the Derelict packages and then, assuming you have SDL2 and OpenGL on your system library search path, you should see it print Success!. Otherwise, you'll get a DerelictException of one kind or another. Note that I didn't give dub a command option. Executing 'dub' with no options will cause it to build and run whatever package is in the current directory. By default, dub will look for source/app.d if you don't configure something differently in dub.json. Executing 'dub build' will build the executable, but will not run it. Thank you Mike, that works perfectly and pretty easy when you know how - something else that is making D feel very comfortable! For anyone else reading this... app.d is in the /source directory created after executing 'dub init' and 'dub' or 'dub build' needs to be run from the project file (the directory containing the dub.json file and /source subdirectory). Both pretty obvious but just in case ;) Thanks John, your tip about dub.json noted!
TKd handling of custom events
Hello, I am using TKd to dray my linux/windows app which works very good! I would like to add a global Hotkey to my program via the Win32 API function RegisterGlobalHotkey. Is there a possibility to access Tk's event loop so that you can Handle the WM_HOTKEY message, the WinAPI sends you? Regards, univacc
Kitchen Offers Reviews
Best kitchens offers reviews i could give are that you don’t pay until the kitchen is delivered.
help
Hello All: when i am using std.net.curl to download a file that dosent exist on ftp sever,my code will get an execption like this std.net.curl.CurlException@std\net\curl.d(3605): Remote file not found on handle 1A8E038 0x0042EC05 0x004027F6 and then it exits,however what i want when it occers is that my code shows an error message like please check the url you typed blablabla not the one above,can anyone give a hand on me ? thanks a lot. Michael.
Re: help
You need to check if remote file exist of server and only after it download шею Also add scope or try catch block to your code.