How can I make this work?

Rumbu rumbu at rumbu.ro
Sun Feb 28 09:04:49 UTC 2021


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 that case?
>
> for example, I need something like this to work:
>
> int[] arr = [1, 2, 3];
> long l = cast(long) cast(void*) arr.ptr;
> int[] a = cast(int[]) cast(void*) l;

LPARAM is not long on 32 bits, it's int. Use LPARAM instead of 
long.



More information about the Digitalmars-d-learn mailing list