Re: Overloading struct members (or cast?)

2014-11-18 Thread Ali Çehreli via Digitalmars-d-learn
On 11/18/2014 11:01 AM, Steven Schveighoffer wrote: > This works in C++: > > struct S > { > union > { >const char *myString; > } Value; > }; > > But the issue is that D does not require the semicolon at the end of the > struct, so by the closing brace, it is done with the unio

Re: Explicitly Freeing Memory

2014-11-18 Thread Vladimir Panteleev via Digitalmars-d-learn
On Wednesday, 19 November 2014 at 03:47:04 UTC, Maxime Chevalier-Boisvert wrote: I posted a thread the other day explaining that I was running into a memory leak issue which is very hard to debug. There seems to be a false pointer somewhere, and I have no way of knowing where that is or which o

Re: Explicitly Freeing Memory

2014-11-18 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Nov 19, 2014 at 03:47:03AM +, Maxime Chevalier-Boisvert via Digitalmars-d-learn wrote: [...] > I'm trying to explicitly free chunks of memory allocated with > GC.malloc() in a destructor. This works fine while the program is > running, but when the program terminates, it seems the GC c

Explicitly Freeing Memory

2014-11-18 Thread Maxime Chevalier-Boisvert via Digitalmars-d-learn
I posted a thread the other day explaining that I was running into a memory leak issue which is very hard to debug. There seems to be a false pointer somewhere, and I have no way of knowing where that is or which object is being pointed to. I decided to take the easy way out and explicitly free

Re: Overloading struct members (or cast?)

2014-11-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/18/14 1:28 PM, Ali Çehreli wrote: On 11/18/2014 07:32 AM, Wsdes wrote: > Error: need 'this' for 'string' of type 'const(char*)' Reduced: struct S { union Value { const char* myString; } } void main() { auto s = S(); auto mine = s.Value.mySt

Re: vibe.d problem

2014-11-18 Thread Martin Nowak via Digitalmars-d-learn
On Tuesday, 18 November 2014 at 13:37:54 UTC, Lázaro Armando via Digitalmars-d-learn wrote: this is very old. try git HEAD instead, it should help. How could I do that using dub? Running `dub upgrade` should be enough as a new version of vibe.d was just released.

Re: Overloading struct members (or cast?)

2014-11-18 Thread Ali Çehreli via Digitalmars-d-learn
On 11/18/2014 07:32 AM, Wsdes wrote: > Error: need 'this' for 'string' of type 'const(char*)' Reduced: struct S { union Value { const char* myString; } } void main() { auto s = S(); auto mine = s.Value.myString;// ERROR } You may be thinking that Va

Re: vibe.d problem

2014-11-18 Thread CraigDillabaugh via Digitalmars-d-learn
On Monday, 17 November 2014 at 22:02:13 UTC, låzaro via Digitalmars-d-learn wrote: Hi there folks, let me the fact talk for me lazaro@leviatan:~$ dub init aplicacion vibe.d Successfully created an empty project in '/home/lazaro/aplicacion'. lazaro@leviatan:~$ cd aplicacion/ lazaro@leviatan:~/

Re: vibe.d problem

2014-11-18 Thread CraigDillabaugh via Digitalmars-d-learn
On Tuesday, 18 November 2014 at 17:16:33 UTC, CraigDillabaugh wrote: On Monday, 17 November 2014 at 22:02:13 UTC, låzaro via Digitalmars-d-learn wrote: Error executing command run: dmd failed with exit code 1. Not sure exactly what your issue is, and am a bit rusty on Vibe/dub, but you may ha

Re: Debugging a Memory Leak

2014-11-18 Thread Etienne via Digitalmars-d-learn
On 2014-11-17 6:12 PM, Maxime Chevalier-Boisvert wrote: Help or advice on solving this problem is welcome. I've tried dumping logs from the garbage collection process and it's the biggest waste of time. Even if you left a reference somewhere, the logs will not help identify the code that caus

Re: vibe.d problem

2014-11-18 Thread Etienne via Digitalmars-d-learn
On 2014-11-18 8:37 AM, Lázaro Armando via Digitalmars-d-learn wrote: How could I do that using dub? You must download the most recent version of dub from http://code.dlang.org Run the commands: dub remove vibe-d --force-remove dub fetch vibe-d --version=0.7.21-rc.4 The list of versions you

Re: Overloading struct members (or cast?)

2014-11-18 Thread bearophile via Digitalmars-d-learn
Wsdes: union value { const char *string; } Try: union Value { const char* myString; } Note the upper caseing, the spacing after the star, and the "string" name replaced with something else. Bye, bearophile

Overloading struct members (or cast?)

2014-11-18 Thread Wsdes via Digitalmars-d-learn
Hello again and welcome to another tale of mystery :) I, again, am facing problems connecting my D program to the C API as seen in the callback thread before. I want to write a callback function that is assigned to a struct member. The function should write data from members of another struc

Re: vibe.d problem

2014-11-18 Thread ketmar via Digitalmars-d-learn
On Tue, 18 Nov 2014 08:37:14 -0500 Lázaro Armando via Digitalmars-d-learn wrote: > Thread name: "Re: vibe.d problem" > Mail number: 2 > Date: Tue, Nov 18, 2014 > In reply to: DigitalmarsD learn > > > > On Mon, 17 Nov 2014 16:24:17 -0500 > > låzaro via Digitalmars-d-learn > > wrote: > > > >

Re: vibe.d problem

2014-11-18 Thread Lázaro Armando via Digitalmars-d-learn
Thread name: "Re: vibe.d problem" Mail number: 2 Date: Tue, Nov 18, 2014 In reply to: DigitalmarsD learn > > On Mon, 17 Nov 2014 16:24:17 -0500 > låzaro via Digitalmars-d-learn > wrote: > > > Building vibe-d 0.7.20 configuration "libevent", build type debug. > this is very old. try git HEAD i

Re: Debugging a Memory Leak

2014-11-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/17/14 11:41 PM, Maxime Chevalier-Boisvert wrote: GC problems are *nasty*. My advice is to run the simplest program you can think of that still exhibits the problem, and then put in printf debugging everywhere to see where it breaks down. Not sure if this is useful. Unfortunately, the pro

Re: get machine arch

2014-11-18 Thread Kagamin via Digitalmars-d-learn
http://dlang.org/phobos/core_cpuid.html#.isX86_64 - this should probably detect x86-64.

Re: Compiling with SQLite

2014-11-18 Thread tcak via Digitalmars-d-learn
On Tuesday, 18 November 2014 at 05:06:59 UTC, impatient-dev wrote: On Tuesday, 18 November 2014 at 03:41:42 UTC, uri wrote: Are you linking with libsqlite3.a? For example: $ dmd prog.d -L-lsqlite3 That worked, thanks. I didn't know you had to anything special to link with code in the standa