Re: more fun with ubuntu

2013-05-26 Thread Ellery Newcomer
On 05/25/2013 10:20 PM, estew wrote: On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote: I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For some reason, ld won't cooperate unless you pass -ldl -lutil

Re: more fun with ubuntu

2013-05-26 Thread estew
huh. I haven't run into it on fedora. python is built differently, though. dmd -L-lpthread -L-ldl -L-lutil -L-L/usr/lib -L-lz /usr/lib/python2.7/config/libpython2.7.a -debug -ofbuild/lib.linux-x86_64-2.7/link {lotsaobjectfiles} -L-ldl -L-lutil -v Well, that should work fine, although the

Re: Passing large or complex data structures to threads

2013-05-26 Thread Joseph Rushton Wakeling
On 05/24/2013 04:39 PM, Simen Kjaeraas wrote: First, *is* it read-only? If so, store it as immutable and enjoy free sharing. If not, how and why not? I can confess that it's as simple as feeling extremely uncomfortable dealing with immutable where it relates to any kind of complex data

Re: Passing large or complex data structures to threads

2013-05-26 Thread Joseph Rushton Wakeling
On 05/24/2013 05:59 PM, Ali Çehreli wrote: The following simple example uses mutable data but it should work with 'const' too. Limiting ourselves to read-only, won't there still be a slowdown caused by multiple threads trying to access the same data? The particular case I have will involve

Re: Passing large or complex data structures to threads

2013-05-26 Thread Simen Kjaeraas
On Sun, 26 May 2013 14:06:39 +0200, Joseph Rushton Wakeling joseph.wakel...@webdrake.net wrote: On 05/24/2013 04:39 PM, Simen Kjaeraas wrote: First, *is* it read-only? If so, store it as immutable and enjoy free sharing. If not, how and why not? I can confess that it's as simple as feeling

Re: Passing large or complex data structures to threads

2013-05-26 Thread Simen Kjaeraas
On Sun, 26 May 2013 14:06:39 +0200, Joseph Rushton Wakeling joseph.wakel...@webdrake.net wrote: On 05/24/2013 04:39 PM, Simen Kjaeraas wrote: First, *is* it read-only? If so, store it as immutable and enjoy free sharing. If not, how and why not? I can confess that it's as simple as feeling

Re: Passing large or complex data structures to threads

2013-05-26 Thread John Colvin
On Sunday, 26 May 2013 at 12:08:41 UTC, Joseph Rushton Wakeling wrote: On 05/24/2013 05:59 PM, Ali Çehreli wrote: The following simple example uses mutable data but it should work with 'const' too. Limiting ourselves to read-only, won't there still be a slowdown caused by multiple threads

lookup fields struct

2013-05-26 Thread mimi
Hi! I am want to get list of fields types and offsets in struct by the template. I.e., lookup through this struct: struct S { int a; string b; someptr* c; }; template Lookup!( S )(); returns something as: field #0, int, offset 0 field #1, string, offset 8, field #2, someptr, offset 16 How

Re: more fun with ubuntu

2013-05-26 Thread Jesse Phillips
On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote: I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For some reason, ld won't cooperate unless you pass -ldl -lutil at the end of the command string.

Re: lookup fields struct

2013-05-26 Thread evilrat
On Sunday, 26 May 2013 at 14:19:13 UTC, mimi wrote: Hi! I am want to get list of fields types and offsets in struct by the template. I.e., lookup through this struct: struct S { int a; string b; someptr* c; }; template Lookup!( S )(); returns something as: field #0, int, offset 0 field

Re: more fun with ubuntu

2013-05-26 Thread Ellery Newcomer
On 05/26/2013 07:55 AM, Jesse Phillips wrote: On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote: I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For some reason, ld won't cooperate unless you pass

Re: more fun with ubuntu

2013-05-26 Thread Ellery Newcomer
On 05/26/2013 08:10 AM, Ellery Newcomer wrote: On 05/26/2013 07:55 AM, Jesse Phillips wrote: On Sunday, 26 May 2013 at 05:01:10 UTC, Ellery Newcomer wrote: I have a project here which fails on link on ubuntu 12.10. It give undefined reference errors for functions in libdl and libutil. For

Re: lookup fields struct

2013-05-26 Thread jerro
On Sunday, 26 May 2013 at 14:19:13 UTC, mimi wrote: Hi! I am want to get list of fields types and offsets in struct by the template. I.e., lookup through this struct: struct S { int a; string b; someptr* c; }; template Lookup!( S )(); returns something as: field #0, int, offset 0 field

Re: Passing large or complex data structures to threads

2013-05-26 Thread Ali Çehreli
On 05/26/2013 05:38 AM, Simen Kjaeraas wrote: Tuple!(size_t, size_t)[][] data = createData(); immutable dataImm = assumeUnique(data); data = null; // Simply to ensure no mutable references exist. The last line is not needed. assumeUnique already does that. :) Ali

Re: more fun with ubuntu

2013-05-26 Thread Mike Wey
On 05/26/2013 06:50 PM, Ellery Newcomer wrote: On Sunday, 26 May 2013 at 16:28:33 UTC, Mike Wey wrote: Try prefixing the python lib with -L like so: dmd -unittest -property -debug -gc -version=Python_2_7_Or_Later -version=Python_2_6_Or_Later -version=Python_2_5_Or_Later

Re: Passing large or complex data structures to threads

2013-05-26 Thread Simen Kjaeraas
On Sun, 26 May 2013 17:59:32 +0200, Ali Çehreli acehr...@yahoo.com wrote: On 05/26/2013 05:38 AM, Simen Kjaeraas wrote: Tuple!(size_t, size_t)[][] data = createData(); immutable dataImm = assumeUnique(data); data = null; // Simply to ensure no mutable references exist.

Bug or feature?

2013-05-26 Thread mimi
import std.stdio; struct S { int bigUglyName; void foo( S s ) { alias bigUglyName local; alias s.bigUglyName b; writeln( bigUglyName (AKA local)=, local, b=, b ); } } void main() { S s1; S s2; s1.bigUglyName = 1; s2.bigUglyName = 2;

Re: lookup fields struct

2013-05-26 Thread mimi
Wow! thanks!

Re: lookup fields struct

2013-05-26 Thread Diggory
On Sunday, 26 May 2013 at 23:37:01 UTC, mimi wrote: Wow! thanks! offsetof will automatically distribute over the arguments so to get the offsets of a tuple you can just do: auto tmp = TP.offsetof; And tmp will be a tuple of the offsets.

Re: Bug or feature?

2013-05-26 Thread Maxim Fomin
On Sunday, 26 May 2013 at 23:35:43 UTC, mimi wrote: import std.stdio; struct S { int bigUglyName; void foo( S s ) { alias bigUglyName local; alias s.bigUglyName b; writeln( bigUglyName (AKA local)=, local, b=, b ); } } void main() { S s1; S