Guidance
指路人
g.yi.org
Guidance Forums / Reginald Rexx / How to access a string Stem in DLL?

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. How to access a string Stem in DLL?
#13312
Posted by: PeterJ 2010-05-22 01:45:12 Last edited by: PeterJ 2010-05-22 01:55:56 (Total edited 3 times)
Jeff, I need an advice: how can I read/write Reginald Stem string variables.

I don't have Problems with Numeric Stems, using

rc=MAX(rc,FUNCDEF('REXXSTEM','32,32[10] dual',envdir||dll,'REXXSTEM'))

in my DLL I receive the address of the stem data and loop through the instances by adding
4 bytes to the address.

But I can't get the string version working:

rc=MAX(rc,FUNCDEF('REXXSTEMS','32,str[10] dual',envdir||dll,'REXXSTEMS'))

I can't really find out what format the data have, which I receive. Is it a lump of date containing all strings seperated by X'00' , or do I get 10 addresses refering to strings, or is there a completly other method.

Your advise is appreciated!

Peter

PS: I got the call back function from a DLL to my script working, it's amazing and very useful!

rexxback='32, str' 
rc=MAX(rc,FUNCDEF('VLIST', '32, func rexxback ,', envdir||dll,'VLIST'))
...
SAY "Now Vlist it" 
vlist('mySay')  /* trigger DLL to call mySay with parameter */ 
EXIT

mysay:
/* the say statement is invoked from the DLL, pretty fast! */
SAY "from DLL" ARG(1)
RETURN 0
Message2. solved!
#13314
Posted by: PeterJ 2010-05-26 01:34:19 Last edited by: PeterJ 2010-05-26 01:40:55 (Total edited 2 times)
this was an RTFM problem:
 str[10] 
doesn't mean an array with 10 strings, it means one string with length 10.
To pass/return a string array we need a structure definition, e.g.
 
mystruct="str[50],str[50],str[50],str[50]"
rc=MAX(rc,FUNCDEF('REXXSTEMS','32,struct myStruct dual',envdir||dll,'REXXSTEMS')) 

in this case you pass 4 string stems with a length of 50 characters
 
xyz.1="This is parameter 1" 
xyz.2="This is parameter 2"
xyz.3="This is parameter 3" 
xyz.4="This is parameter 4"
/* call the DLL function */
SAY rexxstems(xyz)) 
/* output the modified stem variables
do i=1 to 4
   say i XYZ.i
end  
   
To the DLL the content is passed as an address to a contiguous storage area (seems to be in 4K chunks). The first 50 characters belong to xyz.1, the second to xyz.2, etc.
The length 50 results from the "str[50]" definition and will differ depending on the str[x] value. An simple str in a structure defaults to str[1] and not to the actual length as described in the documentation.
Forum List • Thread List • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥1,390.00 ·
 
 
¥287.00 ·
 
 
¥410.00 ·
 
 
¥1,380.00 ·
 
 
¥1,080.00 ·
 
 
¥271.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0