[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: varptr to structs returns bad pointer value
[Thread Prev] | [Thread Next]
- Subject: Re: varptr to structs returns bad pointer value
- From: Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx>
- Date: Tue, 4 Mar 2025 19:48:22 +0200
- To: user@xxxxxxxxxxxxxxxxxxxxxx
> In my opinion, Jussi, in these cases the best solution is the one you > proposed: > > https://lists.gambas-basic.org/archive/user/2025-02/0000234.html > No, this is not suitable. I suggested it before understanding he needed to pass generic structure (IE pointer to some structure that might change). > ..In fact, my suggested code involves a “global” statement. Yes, I know. You are missing the context. This is the correct solution: extern myFunction(data as pointer) use "mylib" public dataSet as pointer public struct myStruct result as long msg as string end struct public mydata as mystruct this works as expected public sub doit() dataSet = alloc(sizeof(mystruct)) mydata = dataSet myFunction(dataSet) ' this works end sub this fails public sub doit2() mydata = new myStruct dataSet = Object.Data(myData) myFunction(dataSet) 'This should also. end sub Jussi
Re: varptr to structs returns bad pointer value | Brian G <brian@xxxxxxxxxxxxxxxx> |
Re: varptr to structs returns bad pointer value | Benoît Minisini <benoit.minisini@xxxxxxxxxxxxxxxx> |
Re: varptr to structs returns bad pointer value | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
Re: varptr to structs returns bad pointer value | vuott@xxxxxxxxxxxx |