[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
varptr to structs returns bad pointer value
[Thread Prev] | [Thread Next]
- Subject: varptr to structs returns bad pointer value
- From: Brian G <brian@xxxxxxxxxxxxxxxx>
- Date: Thu, 27 Feb 2025 12:07:00 -0800
- To: GambasList <user@xxxxxxxxxxxxxxxxxxxxxx>
I am not sure if this is a bug or notWhen passing structures to external c functions varptr fails to produce the correct pointer... to the data of the structure. I think maybe I don't understand the difference, but it would seem they should
produce the same result. 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 = varptr(myData) myFunction(dataSet) ' this fails invalid pointer provided end sub -- ~~~~ Brian
Attachment:
OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
Re: varptr to structs returns bad pointer value | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
Re: varptr to structs returns bad pointer value | vuott@xxxxxxxxxxxx |