[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: Mon, 3 Mar 2025 02:51:33 +0200
- To: vuott@xxxxxxxxxxxx
- Cc: User <user@xxxxxxxxxxxxxxxxxxxxxx>
Oh yes, the problem confirmed. This raises the error correctly: Dim a As New myStruct Print VarPtr(a) The interpreter is confused, because there is a public declaration, which is overdriven locally. Jussi On Mon, Mar 3, 2025 at 2:44 AM Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> wrote: > If I remember correctly structures cannot be declared locally, they must > be at least private... so "mydata = new myStruct" might not be valid. And > as Vuott said there is a missing keyword, which isn't even accepted within > a function. So... maybe this just creates object instead of structure. > > Anyway, some error should be raised. > > > Jussi > > > On Mon, Mar 3, 2025 at 2:24 AM <vuott@xxxxxxxxxxxx> wrote: > >> He should try: >> >> >> Private Extern myFunction(data As Pointer) In "mylib" >> >> Public Struct myStruct >> result As Long >> msg As String >> End Struct >> >> Private myData As Struct Mystruct >> >> Public Sub doit2() >> >> myFunction(VarPtr(myData)) >> >> End >> >> >> ---------------------------------------------------------------------------------- >> >> >> >> >> >> 2 mar 2025, 22:43 da jussi.lahtinen@xxxxxxxxx: >> >> >> No this does not pass the correct pointer, I am trying to pass a generic >> structure, I want to use pointers. >> >> I see, it wasn't clear from the example code you gave. I agree with your >> implementation plan. >> >> >> I am sorry but varptr(xxx) should return a pointer to the actual >> memory containing the structure. >> >> I agree, but this isn't in the documentation and it seems it is not >> implemented [cannot find it under void SUBR_varptr(ushort code) >> ]. For the reasons Benoit knows, this is not raising error either. I >> don't know enough about the implementation details to say more. >> Maybe this can be added. >> >> Jussi >> >> >> >>
Re: varptr to structs returns bad pointer value | Brian G <brian@xxxxxxxxxxxxxxxx> |
Re: varptr to structs returns bad pointer value | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |
Re: varptr to structs returns bad pointer value | vuott@xxxxxxxxxxxx |
Re: varptr to structs returns bad pointer value | Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> |