Re: How can I make this work?

2021-03-16 Thread Jack via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 16:02:14 UTC, Vinod K Chandran wrote: On Sunday, 28 February 2021 at 13:15:47 UTC, Adam D. Ruppe wrote: And it is the simplest thing, no missing length, no weird property casting. The GC handled with two simple add/remove calls. Perfect example of teaching

Re: How can I make this work?

2021-03-16 Thread Vinod K Chandran via Digitalmars-d-learn
On Sunday, 28 February 2021 at 13:15:47 UTC, Adam D. Ruppe wrote: And it is the simplest thing, no missing length, no weird property casting. The GC handled with two simple add/remove calls. Perfect example of teaching something. Thank you for this knowledge. Even though, this was not my

Re: How can I make this work?

2021-03-16 Thread Jack via Digitalmars-d-learn
On Sunday, 28 February 2021 at 13:15:47 UTC, Adam D. Ruppe wrote: On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to pass my D array then access it from that callback

Re: How can I make this work?

2021-02-28 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to pass my D array then access it from that callback function. How is the casting from LPARAM to my type array done in

Re: How can I make this work?

2021-02-28 Thread rikki cattermole via Digitalmars-d-learn
On 28/02/2021 11:05 PM, Max Haughton wrote: Do the windows APIs expect the length in memory rather than as a parameter? This sounds like its being sent via a user field to be passed to a callback. I.e. event loop for a window. In this sort of case you only get one parameter on the callback

Re: How can I make this work?

2021-02-28 Thread Max Haughton via Digitalmars-d-learn
On Sunday, 28 February 2021 at 09:18:56 UTC, Rumbu wrote: On Sunday, 28 February 2021 at 09:04:49 UTC, Rumbu wrote: On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to

Re: How can I make this work?

2021-02-28 Thread Rumbu via Digitalmars-d-learn
On Sunday, 28 February 2021 at 09:04:49 UTC, Rumbu wrote: On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to pass my D array then access it from that callback

Re: How can I make this work?

2021-02-28 Thread Rumbu via Digitalmars-d-learn
On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to pass my D array then access it from that callback function. How is the casting from LPARAM to my type array done in

Re: How can I make this work?

2021-02-28 Thread rikki cattermole via Digitalmars-d-learn
On 28/02/2021 8:05 PM, Jack wrote: int[] arr = [1, 2, 3]; size_t l = cast(size_t)arr.ptr; Okay, so far so good int[] a = cast(int[]) cast(void*) l; Umm, you haven't specified a length? int[] a = (cast(int*)l)[0 .. 3]; If the callback is being called (in effect under the current stack

Re: How can I make this work?

2021-02-27 Thread evilrat via Digitalmars-d-learn
On Sunday, 28 February 2021 at 07:05:27 UTC, Jack wrote: I'm using a windows callback function where the user-defined value is passed thought a LPARAM argument type. I'd like to pass my D array then access it from that callback function. How is the casting from LPARAM to my type array done in