Hi Paolo,
To make an Oxygen program persistent, so that it retains procedures and all state data, after the program is executed. All you have to do is provide a "finish" procedure, which is to be called when the Oxygen program, and all its procedures are no longer required.
Here is a very simple example, where thinBasic is the host.
uses "oxygen"
dim as string src
dim as long pHypot3d
dim as long pFinish
src="
function hypot3d(double a,double b, double c) as double link #pHypot3d
return sqr( a*a+b*b+c*c)
end function
sub finish() link #pFinish
terminate
end sub
"
o2_basic src
if o2_error then
msgbox 0,o2_error
stop
else
o2_exec
end if
declare function Hypot3d(byval double, byval double, byval double ) as double at pHypot3d
declare sub Finish() at pFinish
msgbox 0,Hypot3d(2,3,4)
Finish()
ThinBasic uses customised extension modules, so Oxygen.dll, in this case, is embedded in thinBasic_Oxygen.dll, which provides linkage for procedures and shared variables.
Perhaps I should provide a FreeBasic Host example. The Oxygen compilers, gxo2 and exo2 are written in FreeBasic, but the compiled program does not interact with the host. So I need to show you how this might be done with a FreeBasic host.