Author Topic: Pointer issue  (Read 1636 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Guest
Pointer issue
« on: April 20, 2020, 03:42:53 PM »
Hello Charles, im struggling because pointers do not behave the same in 32bit and 64 bit compilations,
why is that and how can i make them work the same?

For example this:

Code: [Select]
function assign(int d, byval sys * udt) as long
Invoked like this class method:

Code: [Select]
   EXAMPLE abc
   udt.assign(1, @abc)

And used like this inside udt.assign:

Code: [Select]
        ' Clear previous contents.
        copy(@udt, z, len(z))

Works in 32 bits... crashes in 64 bit mode.

Charles Pegge

  • Guest
Re: Pointer issue
« Reply #1 on: April 21, 2020, 01:53:48 AM »
Hi Brian,

When you are passing an address or anon pointer directly, the function should look like this:

Code: [Select]
function assign(int d, sys udt) as long
...
' Clear previous contents.
        copy(udt, z, len(z))


Take care. If you had covid, it can return with a harder bite.

Brian Alvarez

  • Guest
Re: Pointer issue
« Reply #2 on: April 21, 2020, 03:08:16 PM »
Thanks charles, that worked pretty well!

 And yes... im taking good care of myself. In the past weeks i had fever that came and went,
headaches sore throat and other symptoms, but i never had problems breathing... it was
probably something else.

How are you?

Charles Pegge

  • Guest
Re: Pointer issue
« Reply #3 on: April 22, 2020, 06:29:22 AM »

No viral symptoms. Trying to keep as fit as possible, as I can't afford to be below par looking after my Mum. She is 94 on the 25th April.