Re: From D struct to C struct

2013-11-18 Thread Maxim Fomin
On Monday, 18 November 2013 at 16:03:33 UTC, Namespace wrote: On Monday, 18 November 2013 at 15:27:46 UTC, Maxim Fomin wrote: I think there is bigger problem (and bigger memory error) here. When you inside struct method load pointer to some field you cannot rely that after leaving the method,

Re: From D struct to C struct

2013-11-18 Thread Namespace
On Monday, 18 November 2013 at 15:27:46 UTC, Maxim Fomin wrote: On Monday, 18 November 2013 at 14:15:02 UTC, Namespace wrote: On Monday, 18 November 2013 at 10:09:12 UTC, qznc wrote: On Monday, 18 November 2013 at 08:32:11 UTC, Namespace wrote: I found another approach. It avoids the GC and the

Re: From D struct to C struct

2013-11-18 Thread Maxim Fomin
On Monday, 18 November 2013 at 14:15:02 UTC, Namespace wrote: On Monday, 18 November 2013 at 10:09:12 UTC, qznc wrote: On Monday, 18 November 2013 at 08:32:11 UTC, Namespace wrote: I found another approach. It avoids the GC and the Heap: A Circular Buffer: http://dpaste.dzfl.pl/cf1e7afb That

Re: From D struct to C struct

2013-11-18 Thread Namespace
On Monday, 18 November 2013 at 10:09:12 UTC, qznc wrote: On Monday, 18 November 2013 at 08:32:11 UTC, Namespace wrote: I found another approach. It avoids the GC and the Heap: A Circular Buffer: http://dpaste.dzfl.pl/cf1e7afb That should work. It is unsafe, but might work in your specific ca

Re: From D struct to C struct

2013-11-18 Thread qznc
On Monday, 18 November 2013 at 08:32:11 UTC, Namespace wrote: I found another approach. It avoids the GC and the Heap: A Circular Buffer: http://dpaste.dzfl.pl/cf1e7afb That should work. It is unsafe, but might work in your specific case. The problem is that future changes might exhibit memo

Re: From D struct to C struct

2013-11-18 Thread Namespace
I found another approach. It avoids the GC and the Heap: A Circular Buffer: http://dpaste.dzfl.pl/cf1e7afb That should work.

Re: From D struct to C struct

2013-11-17 Thread Namespace
On Sunday, 17 November 2013 at 22:25:54 UTC, qznc wrote: On Sunday, 17 November 2013 at 22:11:02 UTC, Namespace wrote: Hello. I have some trouble with C interfacing. I have a C struct with an integer member and I want to wrap this into a D template. But if I want to access the C API, I have to

Re: From D struct to C struct

2013-11-17 Thread Namespace
On Sunday, 17 November 2013 at 22:25:54 UTC, qznc wrote: On Sunday, 17 November 2013 at 22:11:02 UTC, Namespace wrote: Hello. I have some trouble with C interfacing. I have a C struct with an integer member and I want to wrap this into a D template. But if I want to access the C API, I have to

Re: From D struct to C struct

2013-11-17 Thread qznc
On Sunday, 17 November 2013 at 22:11:02 UTC, Namespace wrote: Hello. I have some trouble with C interfacing. I have a C struct with an integer member and I want to wrap this into a D template. But if I want to access the C API, I have to convert the C struct with the type informations of the D

From D struct to C struct

2013-11-17 Thread Namespace
Hello. I have some trouble with C interfacing. I have a C struct with an integer member and I want to wrap this into a D template. But if I want to access the C API, I have to convert the C struct with the type informations of the D struct. Example: http://dpaste.dzfl.pl/e3d10755 The question