Different struct sizeof between linux and windows

2016-06-16 Thread Andre Pany via Digitalmars-d-learn
Hi, I try to write a wrapper for a library. I translated the C++ header coding. While the wrapper is working fine in linux, on windows the library complains the struct size is too small while calling it. This is the reduced example: import core.stdc.time: time_t; import std.stdio; en

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 09:18:54 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 08:20:00 UTC, Basile B. wrote: Yes it's "WorkingDirectory" (and not current...). But otherwise you can use args[0]. Actually using the cwd in a program is often an error because there is no guarantee that th

Re: OpenGL Setup?

2016-06-16 Thread ketmar via Digitalmars-d-learn
glfw sux. simpledisplay.d rox. https://github.com/adamdruppe/arsd http://dpldocs.info/experimental-docs/arsd.simpledisplay.html

Re: OpenGL Setup?

2016-06-16 Thread Peter Lewis via Digitalmars-d-learn
On Thursday, 16 June 2016 at 19:52:58 UTC, OpenJelly wrote: I just want to install an IDE that's not prone to crashing and comes with standard features like D syntax highlighting, code completion, code folding, side bar with my project's directory, integrated console, bindable key commands (bui

Re: ARSD PNG memory usage

2016-06-16 Thread Joerg Joergonson via Digitalmars-d-learn
On Friday, 17 June 2016 at 04:32:02 UTC, Adam D. Ruppe wrote: On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote: Are you keeping multiple buffers of the image around? A trueimage, a memoryimage, an opengl texture MemoryImage and TrueImage are the same thing, memory is just the i

Re: ARSD PNG memory usage

2016-06-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote: Are you keeping multiple buffers of the image around? A trueimage, a memoryimage, an opengl texture MemoryImage and TrueImage are the same thing, memory is just the interface, true image is the implementation. OpenGL texture is

Re: ARSD PNG memory usage

2016-06-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 17 June 2016 at 02:55:43 UTC, thedeemon wrote: I've bumped into this previously. It allocates a lot of temporary arrays for decoded chunks of data, and I managed to reduce those allocations a bit, here's the version I used: If you can PR any of it to me, I'll merge. It actually has

Re: Accessing COM Objects

2016-06-16 Thread thedeemon via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 21:06:01 UTC, Joerg Joergonson wrote: Ok, I've tried things like uncommenting Document Open(BSTR Document, VARIANT As, VARIANT AsSmartObject); void Load(BSTR Document); /*[id(0x70537673)]*/ BSTR get_ScriptingVersion(); /*[id(0x70464D4D)]*/ doub

Re: ARSD PNG memory usage

2016-06-16 Thread thedeemon via Digitalmars-d-learn
On Friday, 17 June 2016 at 01:51:41 UTC, Joerg Joergonson wrote: Hi, so, do you have any idea why when I load an image with png.d it takes a ton of memory? I've bumped into this previously. It allocates a lot of temporary arrays for decoded chunks of data, and I managed to reduce those alloca

ARSD PNG memory usage

2016-06-16 Thread Joerg Joergonson via Digitalmars-d-learn
Hi, so, do you have any idea why when I load an image with png.d it takes a ton of memory? I have a 3360x2100 that should take around 26mb of memory uncompressed and a bunch of other smaller png files. Are you keeping multiple buffers of the image around? A trueimage, a memoryimage, an openg

std.parallelism.taskPool daemon threads not terminating

2016-06-16 Thread Moritz Maxeiner via Digitalmars-d-learn
So, I am probably overlooking something obvious, but here goes: According to my understanding of daemon threads and what is documented here[1], this following program should terminate once the druntime shuts down, as the thread working on the task is supposed to be a daemon thread: import st

Signals using shared slots

2016-06-16 Thread Dechcaudron via Digitalmars-d-learn
Hey there, I'm currently starting to use signals. They are great (thanks Walter!) but there is an important limitation since the only slots it can take are non-shared, which forces them to operate within a single thread. I understand the `Not safe for multiple threads operating on the same

Re: Linux and htod

2016-06-16 Thread yawniek via Digitalmars-d-learn
On Thursday, 16 June 2016 at 19:04:38 UTC, bachmeier wrote: On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f Just to clarify, so as to prevent confusion by someone that randomly stumbles across thi

Re: OpenGL Setup?

2016-06-16 Thread wobbles via Digitalmars-d-learn
On Thursday, 16 June 2016 at 19:52:58 UTC, OpenJelly wrote: Last time I worked on anything OpenGL in D I was using a Linux machine, and I had to really bend over backward to get set up. I'm using Windows 7 at the moment and I'd like to work on some graphics stuff but I'm pretty lost... I just

Re: const types can't be specialized non-const, if arrays?

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/16/16 3:43 PM, cy wrote: I don't get it. Do I have to write a separate template for arrays specifically or something? NonConst foo(Constant: const NonConst, NonConst)(Constant bar) { pragma(msg,"NonConst is ",NonConst); pragma(msg,"Constant is ",Constant); NonConst foo = bar;

OpenGL Setup?

2016-06-16 Thread OpenJelly via Digitalmars-d-learn
Last time I worked on anything OpenGL in D I was using a Linux machine, and I had to really bend over backward to get set up. I'm using Windows 7 at the moment and I'd like to work on some graphics stuff but I'm pretty lost... I just want to install an IDE that's not prone to crashing and com

const types can't be specialized non-const, if arrays?

2016-06-16 Thread cy via Digitalmars-d-learn
I don't get it. Do I have to write a separate template for arrays specifically or something? NonConst foo(Constant: const NonConst, NonConst)(Constant bar) { pragma(msg,"NonConst is ",NonConst); pragma(msg,"Constant is ",Constant); NonConst foo = bar; return foo;

Re: Linux and htod

2016-06-16 Thread bachmeier via Digitalmars-d-learn
On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f Just to clarify, so as to prevent confusion by someone that randomly stumbles across this post, you do not need htod, dstep, or any other tool to ca

Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 13:12:12 UTC, Gerald wrote: It can be done fine with on the fly changes, i.e. random colors, it's somewhat more work then just calling a simple function call but CSS gives you a lot more power as well. I do this in Terminix where for certain themes I want to set t

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 17:44:08 UTC, Basile B. wrote: Please Stop your comedy. Thanks a lot for your help! This is my solution: import gtk.Main; import gtk.MainWindow; import gtk.CssProvider; import gtk.Button; import gdk.Display; import gdk.Screen; import gtk.StyleContext; import glib.G

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 15:57:36 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 10:14:47 UTC, Basile B. wrote: from args[0] you can get the base bath and since your css is relative to the base path: string cssPath = "test.css"; CssProvider provider = new CssProvider(); pro

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 10:14:47 UTC, Basile B. wrote: from args[0] you can get the base bath and since your css is relative to the base path: string cssPath = "test.css"; CssProvider provider = new CssProvider(); provider.loadFromPath(cssPath); add something like impo

Re: get number of columns and rows in an ndarray.

2016-06-16 Thread Ilya Yaroshenko via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 21:51:25 UTC, learner wrote: Hi, How can i get the number of cols and rows in and ndarray that has already been created? learner Also `sl.length!0`, `sl.length!1`, etc --Ilya

Re: std.array : appender woes

2016-06-16 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/16/16 6:08 AM, abad wrote: On Thursday, 16 June 2016 at 07:59:50 UTC, cym13 wrote: On Thursday, 16 June 2016 at 07:47:03 UTC, abad wrote: import std.array : appender; import std.stdio : writeln; void main() { auto app = appender!(char[]); app.put('x'); auto foo = app.data;

Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread Guido via Digitalmars-d-learn
have a look at `dub convert` - in your case e.g. `dub convert -f sdl` This dub convert command is weird. It works as `cat dub.json | dub convert -sdl' and makes a nice SDL file called dub.sdl, but it blows away the source file, which I've never seen before with piped output from cat. I don't

Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread Seb via Digitalmars-d-learn
On Thursday, 16 June 2016 at 13:20:06 UTC, Guido wrote: On Thursday, 16 June 2016 at 06:07:55 UTC, Seb wrote: On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote: It would seem that by running the file through mixin, you can simply create the vars you want in scope. The drawback being rando

Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread Guido via Digitalmars-d-learn
On Thursday, 16 June 2016 at 06:07:55 UTC, Seb wrote: On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote: It would seem that by running the file through mixin, you can simply create the vars you want in scope. The drawback being random code execution. Is there any way to sanitize mixin code

Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-16 Thread Gerald via Digitalmars-d-learn
On Thursday, 16 June 2016 at 07:58:56 UTC, TheDGuy wrote: On Wednesday, 15 June 2016 at 22:34:05 UTC, Gerald wrote: snip... The text color is green but the button background color is still default-gray! I don't see an obvious issue with your code, I usually use CSS classes personally and I

Re: Linux and htod

2016-06-16 Thread fbmac via Digitalmars-d-learn
On Thursday, 16 June 2016 at 12:39:00 UTC, Dicebot wrote: On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f People don't use htod. https://github.com/jacob-carlborg/dstep is best what one can be for

Re: Linux and htod

2016-06-16 Thread Dicebot via Digitalmars-d-learn
On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f People don't use htod. https://github.com/jacob-carlborg/dstep is best what one can be for plain binding generation.

Re: Linux and htod

2016-06-16 Thread ketmar via Digitalmars-d-learn
On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f we don't.

Re: Why don't we write configuration files in D instead of JSON?

2016-06-16 Thread ketmar via Digitalmars-d-learn
On Thursday, 16 June 2016 at 05:31:26 UTC, Guido wrote: Is there any way to sanitize mixin code from user-configurable file? yes. read json file and convert it to anything you want. ;-)

Linux and htod

2016-06-16 Thread fbmac via Digitalmars-d-learn
How people use it on Linux, if htod is required to import C libraries and windows only?f

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 10:02:01 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 09:27:38 UTC, Basile B. wrote: FOrget any previous comment and in your program use the first argument of the command line to detect your resources, this will solve your problem. For the execution click compil

Re: std.array : appender woes

2016-06-16 Thread abad via Digitalmars-d-learn
On Thursday, 16 June 2016 at 07:59:50 UTC, cym13 wrote: On Thursday, 16 June 2016 at 07:47:03 UTC, abad wrote: import std.array : appender; import std.stdio : writeln; void main() { auto app = appender!(char[]); app.put('x'); auto foo = app.data; app.clear; // done, start a new

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 09:27:38 UTC, Basile B. wrote: FOrget any previous comment and in your program use the first argument of the command line to detect your resources, this will solve your problem. For the execution click compile and run or just run. Okay: void main(string[] args){

Re: arr.ptr, @safe and void*

2016-06-16 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 20:33:54 UTC, Steven Schveighoffer wrote: It could probably do this. Dereferencing a void * isn't valid, so it kind of has the same effect. However, there are many functions which take void * and do write to/read from the data pointing at it (e.g. memcpy). These

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 09:18:54 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 08:20:00 UTC, Basile B. wrote: Yes it's "WorkingDirectory" (and not current...). But otherwise you can use args[0]. Actually using the cwd in a program is often an error because there is no guarantee that th

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 08:20:00 UTC, Basile B. wrote: Yes it's "WorkingDirectory" (and not current...). But otherwise you can use args[0]. Actually using the cwd in a program is often an error because there is no guarantee that the cwd is the path to the application ;) People often forg

Re: Out of order execution

2016-06-16 Thread Rene Zwanenburg via Digitalmars-d-learn
On Thursday, 16 June 2016 at 01:57:19 UTC, Joerg Joergonson wrote: Is there an efficient lazy way to make this happen? No, I don't see how that would work. Suppose I can't run the loop twice for performance reasons(there is other stuff in it) and I don't want to store the state and call info

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread Basile B. via Digitalmars-d-learn
On Thursday, 16 June 2016 at 07:51:14 UTC, TheDGuy wrote: On Thursday, 16 June 2016 at 07:50:13 UTC, TheDGuy wrote: I get 'Failed to execute: 267'. Probably because a symbolic string is used in the run options? https://picload.org/upload,8e3f683557a8cd3401f002304f387932.html That is the corre

Re: std.array : appender woes

2016-06-16 Thread cym13 via Digitalmars-d-learn
On Thursday, 16 June 2016 at 07:47:03 UTC, abad wrote: import std.array : appender; import std.stdio : writeln; void main() { auto app = appender!(char[]); app.put('x'); auto foo = app.data; app.clear; // done, start a new array app.put('y'); writeln(foo); } This prints

Re: GTKD - overrideBackgroundColor of Button doesn't work

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Wednesday, 15 June 2016 at 22:34:05 UTC, Gerald wrote: snip... The text color is green but the button background color is still default-gray! I don't see an obvious issue with your code, I usually use CSS classes personally and I know that works fine because I use this technique all over

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 00:46:44 UTC, Basile B. wrote: On Wednesday, 15 June 2016 at 23:41:51 UTC, Basile B. wrote: - You can create a launcher in the custom tools, excluding the double quote: - as executable type "" - as CurrentDirectory type "" - as alias put something like

Re: GTKD - Application crashes - or not? [Coedit]

2016-06-16 Thread TheDGuy via Digitalmars-d-learn
On Thursday, 16 June 2016 at 07:50:13 UTC, TheDGuy wrote: I get 'Failed to execute: 267'. Probably because a symbolic string is used in the run options? https://picload.org/upload,8e3f683557a8cd3401f002304f387932.html That is the correct image link: https://img1.picload.org/image/rgwaopli/coe

std.array : appender woes

2016-06-16 Thread abad via Digitalmars-d-learn
import std.array : appender; import std.stdio : writeln; void main() { auto app = appender!(char[]); app.put('x'); auto foo = app.data; app.clear; // done, start a new array app.put('y'); writeln(foo); } This prints out 'y'. It's not surprising because what I suppose app

Re: Out of order execution

2016-06-16 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 16 June 2016 at 01:57:19 UTC, Joerg Joergonson wrote: Suppose I have a loop where I execute two functions: for(...) { if (x) Do1(x); if (y) Do2(y); } The problem is, I really always want to execute all the Do2's first then the Do1's. As is, we could get any order of calls.