Re: Converting a string[] to char**

2017-05-09 Thread David Zhang via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 07:59:19 UTC, Stanislav Blinov wrote: On Tuesday, 9 May 2017 at 07:50:33 UTC, David Zhang wrote: If indeed there is no way to avoid allocation, do the allocations have to remain 'alive' for the duration of the instance? Or can I deallocate immediately afterwards? I

Re: Converting a string[] to char**

2017-05-09 Thread Stanislav Blinov via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 07:50:33 UTC, David Zhang wrote: If indeed there is no way to avoid allocation, do the allocations have to remain 'alive' for the duration of the instance? Or can I deallocate immediately afterwards? I can't seem to find it in the Vulkan spec. 2.3.1. Object

Re: Converting a string[] to char**

2017-05-09 Thread David Zhang via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 05:52:28 UTC, Mike Parker wrote: On Tuesday, 9 May 2017 at 05:38:24 UTC, ag0aep6g wrote: You have to create a new array of pointers. As rikki cattermole has pointed out, you also have to null-terminate the individual strings, and pass the amount of pointers in a

Re: Converting a string[] to char**

2017-05-08 Thread ag0aep6g via Digitalmars-d-learn
On 05/09/2017 06:22 AM, David Zhang wrote: I'm playing around with Vulkan, and part of its initialization code calls for an array of strings as char**. I've tried casting directly (cast(char**)) and breaking it down into an array of char*s (char*[]) before getting the pointer to its first

Re: Converting a string[] to char**

2017-05-08 Thread rikki cattermole via Digitalmars-d-learn
On 09/05/2017 5:22 AM, David Zhang wrote: Hi, I'm playing around with Vulkan, and part of its initialization code calls for an array of strings as char**. I've tried casting directly (cast(char**)) and breaking it down into an array of char*s (char*[]) before getting the pointer to its first

Converting a string[] to char**

2017-05-08 Thread David Zhang via Digitalmars-d-learn
Hi, I'm playing around with Vulkan, and part of its initialization code calls for an array of strings as char**. I've tried casting directly (cast(char**)) and breaking it down into an array of char*s (char*[]) before getting the pointer to its first element ([0]). It provides the correct