I get an "Invalid memory location" error in the following code only if I use the Prototype Function with the Runtime feature to call the "HelloWorld" procedure. If I call the "HelloWorld" procedure directly I do not get a memory error. This only happens in 32bit mode. In 64bit mode everything works fine.
Can anyone give me an explanation about what might be the cause of this error?
Code: Select all
;
; Send the response header with the ServerSupportFunction() callback
;
SetStatus(@goParam, "200 OK")
SetHeader(@goParam, "Content-type","text/html; charset=UTF-8")
AddHeader(@goParam,"Connection","Close")
; lcFunc = StrExtract(ServerVariable(*pECB,"PATH_INFO"),goParam\NSp+"/",".pb")
lcFunc="helloworld"
If IsRuntime(lcFunc+"()")
dCFunc.Function = GetRuntimeInteger(lcFunc+"()")
; lcRsp =HelloWorld(*pECB) ; This does not trigger a memory error
lcRsp = dCFunc(*pECB) ; This triggers a memory error
lcRsp = ReplaceString(ReplaceString(lcRsp,"<% PostBack %>",goParam\PostBack),"<% Msg %>",goParam\Msg)
lnLen = StringByteLength(lcRsp,#PB_Ascii)
Else
ErrorToLog("Bad Request("+goParam\Method+goParam\URL+")")
SetStatus(@goParam,"400 Bad Request")
EndIf
AddHeader(@goParam,"Content-Length",Str(lnLen))
AddHeader(@goParam,"Set-Cookie",goParam\Cookie)
EndHeader(@goParam)
Header\pszStatus = Ascii(goParam\SBuf) ; ***Invalid Memory Location Error occurs here when calling HelloWorld using the function prototype above
Header\pszHeader = Ascii(goParam\HBuf)
Header\cchStatus = StringByteLength(goParam\SBuf,#PB_Ascii)
Header\cchHeader = StringByteLength(goParam\HBuf,#PB_Ascii)
Header\fKeepConn = #False
*pECB\ServerSupportFunction(*pECB\ConnID, #HSE_REQ_SEND_RESPONSE_HEADER_EX, @Header,#Null, #Null)