John,
Based on your mods to Demo 6, the next step is to create a persistent program from SB and be able to call its functions at any time from the SB application.
'COMPILE --> ERROR CHECK --> STARTUP --> FUNCTION CALLS --> STOP
This example also demonstrates direct coupling (by pointer) to the send buffer and also the receive buffer:
dll ("ms,i,sbo2.dll,callfun,LzZL", mainfun, send, receive, bufferlength)
'--------------------------------------
'WORKING WITH A PERSISTENT O2H PROGRAME
'--------------------------------------
declare sub dll alias "dyc" lib "dyc"
'OXYGEN SOURCE CODE
'
prog="""
function main(zstring * SBSends, zstring * SBReceives, sys bufferlength) as sys external
'print SBsends
string tab=chr 9, cr=chr(13)+chr(10)
single v=(1 2 3 4)*2+1.25
SBReceives = SBSends cr "O2H responds" tab str(v) tab chr(0)
end function
map[1]= & main
""" & chr(0)
mainfun=1
send="SB Sends a message" & chr(0)
bufferlength = 1000
receive = space(bufferlength)
'COMPILE --> ERROR CHECK --> STARTUP --> FUNCTION CALLS --> STOP
compilerrl= dll( "ms,i,sbo2.dll,compile,ZZL", prog, receive, bufferlength)
if compilerrl>0 then
print left(receive,compilerrl)
else
dll ("ms,i,sbo2.dll,start,L",0)
dll ("ms,i,sbo2.dll,callfun,LzZL", mainfun, send, receive, bufferlength)
'
split receive by "\t" to s1, s2, s3
print s1,"\n"
print format("%6.4f",s2),"\n"
'
dll ("ms,i,sbo2.dll,stop,L", 0)
end if
line input w
Charles
[attachment deleted by admin]