Re: Convert C array pointer to a D slice without data copy

2015-05-18 Thread John Colvin via Digitalmars-d-learn
On Monday, 18 May 2015 at 09:23:26 UTC, tcak wrote: On Monday, 18 May 2015 at 09:18:33 UTC, ParticlePeter wrote: I get the point to an array from a c function, the data size from another function. The data should be only readable at the D side, but I would like to use it as a D slice without c

Re: Convert C array pointer to a D slice without data copy

2015-05-18 Thread ParticlePeter via Digitalmars-d-learn
On Monday, 18 May 2015 at 09:23:26 UTC, tcak wrote: On Monday, 18 May 2015 at 09:18:33 UTC, ParticlePeter wrote: I get the point to an array from a c function, the data size from another function. The data should be only readable at the D side, but I would like to use it as a D slice without c

Re: Convert C array pointer to a D slice without data copy

2015-05-18 Thread Marco Leise via Digitalmars-d-learn
Am Mon, 18 May 2015 09:51:48 + schrieb "John Colvin" : > No need to worry about the GC here, it only scans the stack and > its own heap (unless you specifically add a new root). And even if you add a root it wont free anything it did not allocate itself! You could even append to your C array

Re: Convert C array pointer to a D slice without data copy

2015-05-18 Thread tcak via Digitalmars-d-learn
On Monday, 18 May 2015 at 09:18:33 UTC, ParticlePeter wrote: I get the point to an array from a c function, the data size from another function. The data should be only readable at the D side, but I would like to use it as a D slice without copying the data. Is this possible ? char* dataPtr;