Hi all,
Can someone please explain why this code gpf?
Not always...just sometimes. I double checked
not going beyond array bonds and the pointers > 0,
...same thing. I'm not using strptr(string) but varptr(string).
I isolated this offending snippet. Actually, the type shown
below has many other pointers, but just the string ptr gpf.
The weird thing, it sometimes gpf when reading, others when
trying to assign a string. There is something I'm doing wrong?
Thanks in advance
Gus
Can someone please explain why this code gpf?
Not always...just sometimes. I double checked
not going beyond array bonds and the pointers > 0,
...same thing. I'm not using strptr(string) but varptr(string).
I isolated this offending snippet. Actually, the type shown
below has many other pointers, but just the string ptr gpf.
The weird thing, it sometimes gpf when reading, others when
trying to assign a string. There is something I'm doing wrong?
Thanks in advance

Gus
Code:
type main_type nstr as string ptr idx as long end type function mainthing() as long '<- main entrance local mtp as main_type local pmtp as dword local names() as string redim names(512) mtp.nstr = varptr(names(0)) mtp.idx = 3 pmtp = varptr(mtp) ' then some processing...ie redim preserve names(ubound(names)+1) array insert names(), "this thing" '... names(28) = "this other guy" ' then a call to do some other processing dothings(pmst) '... '... end function function dothings(byval mtp as main_type ptr) as long local st as string st = "damngpf" @[email protected][@mtp.idx] = st '<---THIS GPFs st = @[email protected][@mtp.idx] '<---THIS also GPFs @[email protected][1] = st '<---THIS GPFs st = @[email protected][1] '<---THIS also GPFs!!! end function
Comment