Re: Passing string array to C

2020-09-10 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 10 September 2020 at 15:41:17 UTC, Adam D. Ruppe wrote: On Thursday, 10 September 2020 at 14:31:41 UTC, Andre Pany wrote: [...] You messed up the pointers. [...] Fantastic, thank you so much Adam. Kind regards André

Re: Access violation when using IShellFolder2

2020-09-10 Thread FreeSlave via Digitalmars-d-learn
On Thursday, 10 September 2020 at 15:20:54 UTC, John Chapman wrote: On Thursday, 10 September 2020 at 13:30:15 UTC, FreeSlave wrote: Thanks. I tried this, but VarDateFromStr does not succeed for me. It turns out the shell embeds some control characters in the string, specifically 8206 and

Reducing .init effect of a struct that has large static array members

2020-09-10 Thread Ali Çehreli via Digitalmars-d-learn
[tldr; I have come up with a way of removing all undesired effects of large static array struct members. See conclusion at the bottom.] Continuing the discussion at https://forum.dlang.org/thread/rdk3m2$725$1...@digitalmars.com and understanding kinke's comments there better... And this is

Re: Passing string array to C

2020-09-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 10 September 2020 at 14:31:41 UTC, Andre Pany wrote: Why does it crash? You messed up the pointers. A string is one star. An array of strings is two stars. A pointer to an array of strings is /three/ stars. --- import std; void main() { size_t* i; // this need not be

Re: Access violation when using IShellFolder2

2020-09-10 Thread John Chapman via Digitalmars-d-learn
On Thursday, 10 September 2020 at 13:30:15 UTC, FreeSlave wrote: Thanks. I tried this, but VarDateFromStr does not succeed for me. It turns out the shell embeds some control characters in the string, specifically 8206 and 8207. So remove those before passing it to VarDateFromStr. auto temp

Passing string array to C

2020-09-10 Thread Andre Pany via Digitalmars-d-learn
Hi, I have this coding. Function `sample` will later be called from C and should provide access to a string array. I tried to read the string values after the function call and I can access the first string, but for the second string, there is an access violation. Why does it crash? Kind

Re: Trouble with Android and arsd.jni

2020-09-10 Thread kinke via Digitalmars-d-learn
On Thursday, 10 September 2020 at 13:14:00 UTC, burt wrote: However, the app is still crashing when I load it, and there appears to be an issue in Runtime.initialize(), which is called from JNI_OnLoad(), which is defined in arsd.jni. The debugger tells me that it was calling

Re: UDA inheritance

2020-09-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 10 September 2020 at 13:06:41 UTC, Joseph Rushton Wakeling wrote: `hasUDA!(T, AnotherUDA)` ...do you have to use hasUDA? The language works with class UDAs, but hasUDA doesn't support it. If you write your own test function though you can: ``import std.traits; class BaseUDA {

Re: Access violation when using IShellFolder2

2020-09-10 Thread FreeSlave via Digitalmars-d-learn
On Thursday, 10 September 2020 at 06:43:35 UTC, John Chapman wrote: On Wednesday, 9 September 2020 at 22:44:50 UTC, FreeSlave wrote: Btw do you know how to parse a date returned by GetDetailsOf? Couldn't find any examples in C++. I actually can see digits representing date and time as a part

Re: UDA inheritance

2020-09-10 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
On Thursday, 10 September 2020 at 13:14:47 UTC, drug wrote: Just a thought - couldn't you use classes for this? Get an UDA and check if it is a descendant of the specific class. Yes, I did wonder about that, but it doesn't allow all the inference that I'm looking for. For example:

Re: UDA inheritance

2020-09-10 Thread drug via Digitalmars-d-learn
On 9/10/20 4:06 PM, Joseph Rushton Wakeling wrote: Hello folks, Is there any way to define UDAs such that they automatically inherit other UDA definitions? For example, suppose I define:     enum BaseUDA { A, B } Is there a way to define `AnotherUDA` such that if `hasUDA!(T, AnotherUDA)`

Re: Trouble with Android and arsd.jni

2020-09-10 Thread burt via Digitalmars-d-learn
On Thursday, 10 September 2020 at 11:58:51 UTC, kinke wrote: On Thursday, 10 September 2020 at 11:16:55 UTC, burt wrote: However, I am getting linker errors, telling me that _tlsend, _tlsstart and __bss_end__ are missing. Perhaps you happen to use some stale artifacts? These magic symbols

UDA inheritance

2020-09-10 Thread Joseph Rushton Wakeling via Digitalmars-d-learn
Hello folks, Is there any way to define UDAs such that they automatically inherit other UDA definitions? For example, suppose I define: enum BaseUDA { A, B } Is there a way to define `AnotherUDA` such that if `hasUDA!(T, AnotherUDA)` then it is a given that `hasUDA!(T, BaseUDA)` will

Re: Trouble with Android and arsd.jni

2020-09-10 Thread kinke via Digitalmars-d-learn
On Thursday, 10 September 2020 at 11:16:55 UTC, burt wrote: However, I am getting linker errors, telling me that _tlsend, _tlsstart and __bss_end__ are missing. Perhaps you happen to use some stale artifacts? These magic symbols aren't used anymore in druntime since LDC v1.21, and not

Trouble with Android and arsd.jni

2020-09-10 Thread burt via Digitalmars-d-learn
Hello, I'm trying to upgrade and improve an Android project I was working on a while ago. For this reason, I decided to upgrade my compiler to the newest LDC (v1.23.0). I am using the arsd.jni library for the JNI headers and for initializing the runtime. However, I am getting linker errors,

Re: Access violation when using IShellFolder2

2020-09-10 Thread John Chapman via Digitalmars-d-learn
On Wednesday, 9 September 2020 at 22:44:50 UTC, FreeSlave wrote: Btw do you know how to parse a date returned by GetDetailsOf? Couldn't find any examples in C++. I actually can see digits representing date and time as a part of the string, but I would prefer to use some winapi function to