Re: Current status of DLLs

2012-11-07 Thread Jakob Ovrum
On Wednesday, 7 November 2012 at 10:24:25 UTC, Benjamin Thaut wrote: For example: Exporting the Module init symbol is not supported, so every module that only exists in a dll will generate a linker error. Also I had some cases where even the vtable symbol did not get exported (despite the that

Re: Recursive data structure using template won't compile

2012-11-07 Thread Rob T
If I use a pointer as the payload type for my d_list, it compiles OK. I'd rather not use a pointer for the payload, and it will compile in D if I hard code in the payload type. --rt

Recursive data structure using template won't compile

2012-11-07 Thread Rob T
I want to create a simple recursive data structure as follows: struct R { int value; d_list!R Rlist; } // d-linked list with templated payload struct d_list( T ) { struct node { T payload; node* pred; node* succ; } node* head; node* tail; } The compiler co

Re: Manually freeing up memory

2012-11-07 Thread Marco Leise
Am Wed, 07 Nov 2012 19:56:35 +0100 schrieb Joseph Rushton Wakeling : > On 11/07/2012 06:53 PM, H. S. Teoh wrote: > > I think on Posix systems, malloc/free does not return freed memory back > > to the OS, it just gets reused by the process later on. > > I have to say that in this program, it looks

Re: Current status of DLLs

2012-11-07 Thread Benjamin Thaut
Am 07.11.2012 21:31, schrieb DypthroposTheImposter: thanks, do you happen to know which D compilers can output to a format that is capable of linking with visual studio(specifically 2012) C++? Ya I'm ok with the C interface, kinda what I expected.. The best option would be to use the digital m

Re: Current status of DLLs

2012-11-07 Thread DypthroposTheImposter
thanks, do you happen to know which D compilers can output to a format that is capable of linking with visual studio(specifically 2012) C++? Ya I'm ok with the C interface, kinda what I expected..

Re: Current status of DLLs

2012-11-07 Thread Benjamin Thaut
Am 07.11.2012 20:01, schrieb DypthroposTheImposter: can you statically link D to C++(no dll)? If you compile it with a compiler that puts out the same object format, yes. But if you want to have a interface to C or C++ you will need a C-Style interface anyway, so that works with DLLs. Kind

Re: Current status of DLLs

2012-11-07 Thread DypthroposTheImposter
can you statically link D to C++(no dll)?

Re: Manually freeing up memory

2012-11-07 Thread Joseph Rushton Wakeling
On 11/07/2012 06:53 PM, H. S. Teoh wrote: I think on Posix systems, malloc/free does not return freed memory back to the OS, it just gets reused by the process later on. I have to say that in this program, it looks like the memory usage keeps increasing even after the free(), even though theor

Re: How to fix opAssign signature

2012-11-07 Thread Dan
On Friday, 2 November 2012 at 15:56:47 UTC, Ali Çehreli wrote: ref D opAssign(D other) { swap(c, other.c); return this; } There may be corner cases where this is not efficient, but considering that assignment involves two sub-operations (make a copy of the new state an

Re: Manually freeing up memory

2012-11-07 Thread H. S. Teoh
On Wed, Nov 07, 2012 at 06:12:52PM +0100, bearophile wrote: > Joseph Rushton Wakeling: > > >... but despite the GC.free(), memory usage stays at peak level > >for the rest of the runtime of the function. > > GC.free() usually works. Some memory allocators don't give back the > memory to the OS, n

Re: Manually freeing up memory

2012-11-07 Thread bearophile
Joseph Rushton Wakeling: ... but despite the GC.free(), memory usage stays at peak level for the rest of the runtime of the function. GC.free() usually works. Some memory allocators don't give back the memory to the OS, no matter what, until the process is over, despite that memory is free f

Re: Manually freeing up memory

2012-11-07 Thread Joseph Rushton Wakeling
On 11/07/2012 03:17 PM, bearophile wrote: One solution is to allocate the original array on the C heap. Another solution is to allocate it normally from the GC heap and then use GC.free(). Well, what I've got is something like this: auto raw = rawInput(); /* loads data and outputs a

Re: Manually freeing up memory

2012-11-07 Thread bearophile
Joseph Rushton Wakeling: Can anyone advise? I would rather not disable the GC entirely as there's lots of Phobos I want to be able to use -- but I'd really like it if I could indicate categorically to the GC, "these objects and arrays need to be deleted and the memory freed _now_". One sol

Manually freeing up memory

2012-11-07 Thread Joseph Rushton Wakeling
Hello all, I'm doing some work with a fairly large dataset. For various reasons it's convenient to import it first as simply an array of data points which is then used to generate other data structures (actually, technically it's an array of data points plus a couple of associative arrays, wh

Re: *in* vs *const ref*

2012-11-07 Thread Dan
Very clear and much appreciated. On Tuesday, 6 November 2012 at 23:38:00 UTC, Jonathan M Davis wrote: If a function requires an lvalue, then you have to pass a [snip] You'd have to do something like string file = __FILE__; size_t line = __LINE__; auto f = foo(); auto b = bar(7); writefln("%

Re: Performance of hashes and associative arrays

2012-11-07 Thread Dan
On Wednesday, 7 November 2012 at 06:38:32 UTC, Raphaël Jakse wrote: == override size_t toHash() const { return (typeid(firstName).getHash(&firstName) + typeid(lastName).getHash(&lastName)); } == Isn't the real problem the addition. You want to mix the bits

Re: Current status of DLLs

2012-11-07 Thread Benjamin Thaut
Am 07.11.2012 03:04, schrieb Matt: The DLL page on the main D site is out of date in its example, importing module std.gc, which doesn't exist. Has connecting to DLLs become easier, harder, or just plain different? And in what ways should I go about doing so? My personal requirement is dynamic lo