[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: varptr to structs returns bad pointer value


No this does not pass the correct pointer, I am trying to pass a generic structure, I want to use pointers.
I am sorry but varptr(xxx)    should return a pointer to the actual 
memory containing the structure.
I don't want to create 10 or fifteen extern descriptions one for each 
type of structure that can be passed. Trying to create unique names and 
that seems silly.
The structures contains a key in the first field that identifies them to 
the interface.
Why is the varptr not returning the correct pointer?

My work around is to do the alloc and assign for now...... but it does not seem right.
On 2/27/25 14:44, Jussi Lahtinen wrote:
And I think this should be:
extern myFunction(data as myStruct) use "mylib"


Jussi

On Fri, Feb 28, 2025 at 12:27 AM Jussi Lahtinen <jussi.lahtinen@xxxxxxxxx> wrote:
        public sub doit2()
           mydata = new myStruct
           dataSet = varptr(myData)
           myFunction(dataSet)  ' this fails invalid pointer provided
        end sub


    Try:

        public sub doit2()
           mydata = new myStruct
           myFunction(mydata)
        end sub



    Jussi



--
~~~~ Brian

Attachment: OpenPGP_0x78BFB26402F48419.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


Follow-Ups:
Re: varptr to structs returns bad pointer valueJussi Lahtinen <jussi.lahtinen@xxxxxxxxx>