Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: PSafeArray by reference vs by value.



Permlink Replies: 2 - Last Post: Jun 25, 2014 12:08 PM Last Post By: Allen Noland
Allen Noland

Posts: 45
Registered: 1/11/03
PSafeArray by reference vs by value.
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 24, 2014 1:15 PM
I have a COM SDK that with the last version changed a procedure from

procedure Initialize(controls: PSafeArray); safecall;

to

procedure Initialize(var controls: PSafeArray); safecall;

I currently call the procedure like this and it works fine.

m_Controller.Initialize(PSafeArray(TVarData(m_editControlArray).VArray))

Will the call be different now that the controls variable is passed by reference?

Thanks in advance!

Allen

Edited by: Allen Noland on Jun 24, 2014 4:02 PM
Peter Below

Posts: 1,227
Registered: 12/16/99
Re: PSafeArray by reference vs by value. [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 25, 2014 10:08 AM   in response to: Allen Noland in response to: Allen Noland
Allen Noland wrote:

I have a COM SDK that with the last version changed a procedure from

procedure Initialize(controls: PSafeArray); safecall;

to

procedure Initialize(var controls: PSafeArray); safecall;

I currently call the procedure like this and it works fine.

m_Controller.Initialize(PSafeArray(TVarData(m_editControlArray).VArray
))

Will the call be different now that the controls variable is passed
by reference?

The syntax you use should keep working, but what the compiler will pass
will change. In the old version it passed the content of the VArray
field, in the new one it will pass the address of the VArray field.


--
Peter Below (TeamB)

Allen Noland

Posts: 45
Registered: 1/11/03
Re: PSafeArray by reference vs by value. [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 25, 2014 12:08 PM   in response to: Peter Below in response to: Peter Below
Thanks Peter Below

That is how I thought it worked, but just wanted to make sure.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02