Quote from: Charles Pegge on February 21, 2023, 12:45:11 AM
But there is hidden code: the thinBasic_Oxygen.dll module to mediate between thinBasic and o2. It is rather similar to co2, though it can also share variables and support function calls directly. Is this what you intend to do?
If OpenLibrary(0, "Oxygen.dll")
thestring = "result=10+20"
oAddr = CallFunction(0, "o2_basic", @"thestring")
'and/or instead of thestring, an .o2bas file
'Use o2_exec to execute thestring, and return the result
oExec = CallFunction(0, "o2_exec", oAddr)
'Get the result, which should be 30, and store it in oString
'Not sure how this would be accomplished.
If OpenConsole()
PrintN(oString)
EndIf
Else
PrintN("Error opening oxygen.dll")
EndIf
uses "oxygen"
dim as string src
src="
print "Hello World!"
"
o2_basic src
if o2_errno then
msgbox 0,o2_error
stop
else
o2_exec
end if
No external co2.exe is required to compile and execute that code.
function Exec(string c, int wait=0) as int
==========================================
STARTUPINFO infs
PROCESS_INFORMATION infp
CreateProcess null,c,0,0,0,0,0,0,@infs,@infp
if wait
WaitForMultipleObjects 1,@infp.hthread,1,-1
end if
GetExitCodeProcess(infp.hProcess,@function)
CloseHandle infp.hProcess
CloseHandle infp.hThread
end function
Page created in 0.464 seconds with 14 queries.