Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Passing array to mac - pointer issues
#1
Hi Gintaras,

if I pass an ARRAY(str) variable to a function, it works fine with receiving function written as 
function ARRAY(str)'arrTest
or 
function ARRAY(str)&arrTest

depending on whether I am returning any values back to the calling function.

However, if I call it as a mac using function ARRAY(str)'arrTest (because it can't wait for return), it says:

'parameters must be of intrinsic or pointer types.'

note, I am calling the mac as:

mac "RecevingFunc" "" arrTest

I have read the forum on this and this is one of the toughest areas of programming for me.
If just uni-dimensional array, I could just change it to string collection but harder if multi-dimensional.
Any pointers on how to do this? (that was a pun!)
Seriously, any help appreciated!
Thanks, S

Macro Macro10
Code:
Copy      Help
str strTestColl = "a[]b[]c[]d[]e[]f[]g"
ARRAY(str) arrTest = strTestColl
mac "ReceiveArrayAsMac" "" arrTest

Function ReceiveArrayAsMac
Code:
Copy      Help
function ARRAY(str)'arrTest

out F"arrTest.len: {arrTest.len}"
for _i 0 arrTest.len
,out F"{_i}: '{arrTest[_i]}'"
#2
In QM it is not easy.

Macro Macro321
Code:
Copy      Help
str strTestColl = "a[]b[]c[]d[]e[]f[]g"
ARRAY(str) arrTest = strTestColl

mac "sub.Thread" "" arrTest.psa
arrTest.psa=0


#sub Thread
function SAFEARRAY*p
ARRAY(str) arrTest.psa=p

out F"arrTest.len: {arrTest.len}"
for _i 0 arrTest.len
,out F"{_i}: '{arrTest[_i]}'"

But it cannot be used if ReceiveArrayAsMac runs in separate process. Then need to serialize/deserialize the array somehow, for example convert to/from string.
#3
perfect. now I know what to do. just wanted to make sure it wasn't some missing '&' or * that was the issue. Much appreciated.
Stuart
#4
If arrTest is used after mac, copy it:

ARRAY(str) arrTest2=arrTest
mac "sub.Thread" "" arrTest2.psa
arrTest2.psa=0


Forum Jump:


Users browsing this thread: 1 Guest(s)