I've been reviewing Oxygen Basic the last couple of days,
on the hope that I can create a plugin for JPSoftware's TCC.EXE
Ref: https://jpsoft.com/
When TCC.EXE was a 32-bit application,
I wrote my plugins using PowerBasic 8 for Windows.
As TCC.EXE is now a 64-bit application,
and PowerBasic is still 32-bit,
I purchased PureBasic to develop 64-bit plugins for TCC.EXE
The first plugin that I converted from 32-bit PowerBasic
to 64-bit PureBasic
was my plugin that allowed the reading of .DBF files.
Ref: https://www.jpsoft.com/forums/threads/64-bit-plugin-development-using-purebasic.10988/
The second 64-bit plugin I developed for TCC.EXE
allowed me to run VBScript files and functions,
fixing the problems that the TCC Script Command had.
Ref: https://jpsoft.com/forums/threads/script-and-getobject.10696/post-60212
Ref: https://jpsoft.com/forums/threads/activescript-for-vbscript.11353/
Ref: https://jpsoft.com/help/script.htm
I would like to develop a plugin that will include Oxygen Basic.
My first step involves getting 64-bit PureBasic to work with the oxygen.dll file.
I note that oxygen.dll is a 32-bit dll,
Quoteoxygen.dll: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows, UPX compressed
which contains the following exports;
QuoteMicrosoft (R) COFF/PE Dumper Version 14.34.31937.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file oxygen.dll
File Type: DLL
Section contains the following exports for oxygen.dll
00000000 characteristics
0 time date stamp
0.00 version
1 ordinal base
16 number of functions
16 number of names
ordinal hint RVA name
1 0 00076910 o2_abst
2 1 00076780 o2_basic
3 2 000753B0 o2_buf
4 3 00076980 o2_errno
5 4 000769D0 o2_error
6 5 00075600 o2_exec
7 6 00075360 o2_len
8 7 000754B0 o2_lib
9 8 000756B0 o2_link
10 9 00075330 o2_mode
11 A 00075300 o2_pathcall
12 B 000768C0 o2_prep
13 C 000761B0 o2_stats
14 D 000752D0 o2_varcall
15 E 00076A40 o2_version
16 F 00076870 o2_view
Summary
29E000 UPX0
1F000 UPX1
1000 UPX2
I need a 64-bit version of oxygen.dll in order to work with 64-bit PureBasic.
Is there a 64-bit version of oxygen.dll?
How can I create a 64-bit version of oxygen.dll?
I am nowhere near an expert programmer as others on the forum,
so constructive suggestions and corrections would be appreciated.
Regards,
Joe
Hi Joe,
you can produce both 32 and 64bit DLLS with the 32bit o2 compiler. But we don't have a stable 64bit self-compiling o2 yet. You would only need this if you were using Oxygen as a sub-system at run-time in your application. Do you really need this?
This is a want, not a need.
Having an Oxygen plugin for TCC would make Oxygen an embedded/internal interpreter,
similar to the TCC Lua embedded/internal interpreter.
Ref: https://jpsoft.com/help/lua.htm
...or like my ActiveScript plugin,
which allows me to run my VBScript code.
Ref: https://jpsoft.com/forums/threads/activescript-for-vbscript.11353/
My goal of having Oxygen as an embedded/internal interpreter in TCC
is not to have Oxygen produce .EXEs or .DLLs,
but simply to compile and execute directly in memory.
Developing an Oxygen plugin would allow me to integrate it with TCC via the TCC SDK.
Ref: https://jpsoft.com/all-downloads/plugins-take-command.html
This would essentialy allow the use of Oxygen as a sub-system of TCC at run-time.
It would be similar to how Oxygen has been integrated
with ThinBasic and PowerBasic,
that is,
my plugin would be able to read an Oxygen Source Code file,
and then execute it in memory.
Thus, I first need to have Oxygen integrate with the 64-bit PureBasic,
and then I would use 64-bit PureBasic to develop my 64-bit plugin for TCC.
Ref: http://www.jose.it-berater.org/smfforum/index.php?topic=4638.msg17900#msg17900
Again, this is a want, not a need.
Regards,
Joe
I am not sure that i understand whole hype around plugins you want
i made 64bit .dll in o2 for one java based language called Dragon lang and work well.
o2 is normally invoked using co2.exe in a new separate process. So the 32/64 bitness does not matter. You can see how it is done in tools/ Oxide.o2bas and Peroxide.o2bas which both use inc\sysutil.inc exec
Exec(sd+"\co2.exe "+f,0) 'assume co2 path
from sysutil.inc
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
That requires co2.exe to be installed on the users system, correct?
That defeats the purpose of creating an Oxygen Plugin for TCC,
as it would require co2.exe,
an external,
to compile and execute the .o2bas file.
Take for example, this ThinBasic code, HelloWorld.tbasic;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.
I would like to do the same thing, except do this under 64-bit PureBasic.
Once I am able to do this with 64-bit PureBasic,
I can then use 64-bit PureBasic to develop a 64-bit plugin for TCC,
that would have Oxygen embedded into the sub-system of TCC at run-time.
Regards,
Joe
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?
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?
Indeed.
Although, I do not need the ability to create .EXE or .DLL files.
All I want to do is to be able to execute an .o2bas file from 64-bit PureBasic, and get the results back from the execution.
Something along this theoretical example 64-bit PureBasic code;
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
Regards,
Joe
Charles .
I think that he means on o2 compile function
hmm but i am not sure , i have PureBasic (old version)
maybe i can try PB code ...
I think it is possible with the current o2/co2 using shared-memory for data passing between processes, but ideally a 64bit o2 would be the best solution. Time is the problem. Are you in a hurry, Joe?
Indeed, a 64-bit oxygen.dll would be the best solution.
No big hurry, no big rush.
Thankyou for your assistance.
Regards,
Joe
Rex Conn has been, and is, the owner of JP Software.
I've been using his software since the 1980s, when it was called 4Dos.
More about Rex Conn at https://www.linkedin.com/in/rexconn
Or, if you want, you can converse with him on the forums
Ref: https://jpsoft.com/forums/
or via email support@jpsoft.com
Joe
If anyone is interested in the 4DOS Source Code,
before it became TakeCommandConsole (TCC.EXE) for Windows,
it is available from;
https://4dos.info/sources.htm
I think that Rex Conn released the source code for 4DOS back around 2004,
but I cannot remember for sure.
Luchezar Georgiev took over after that,
and took 4DOS from version 7.50 to version 8.00
Joe
Ok, good to know. He should just put his name on the WEB-Site.
To me generally the program sounds useful for System Administration.
Charles,
About the 64bit o2 compiler dll, are we talking one year, two, five ?
I guess we all agree that a one hour project may easilly end up with a few weeks of work.
In this perspective, I do not ask any precision at all.
Still, I'd like to know your projections... If you want to share, of course...
Thanks
Hi Pierre,
I've made good progress this week on Oxygen64.dll. It has passed the minimal self-compile test and also compiles my most complex GLSL code as well as other pieces. I can release it with 070 for you to try out. It requires a 64 bit compiler co2m64.exe for want of a better name.
Wow!
This I like. Real good news. You are great.
I will try as soon as avaialable.
Still lot of fun with the current one in the mean time.
Thanks Charles.
I've just posted OxygenBasic070 including co2m64.exe and oxygen64.dll.
You can use co2m64 from the console or Oxide (shift F5 to run direct) or Peroxide64.
the version macro will now display 32bit or 64bit compiler bitness.
Charles,
Can I use co2m64 instead of co2 for compiling to a 64bit exe . I never use 32 bit.
This is my current command line usage
cO2 -m -64 C:\OxygenBasic\demos\!ProjA\Controls\DlgCtrl
I tried this but it also ran the program
co2m64 -m C:\OxygenBasic\demos\!ProjA\Controls\DlgCtrl
James
The only difference between co2 and co2m64 is that the latter loads oxygen64.dll. This means that the compiler switches behave the same for producing 32bit/64 binaries. But direct execution will, of course be 64 bit, as you specify here:
co2m64 -m C:\OxygenBasic\demos\!ProjA\Controls\DlgCtrl
and producing 64bit binaries will still require the -64 switch:
co2m64 -m -64 C:\OxygenBasic\demos\!ProjA\Controls\DlgCtrl
Hi Charles
I don't want to be a "retro pedro" but where gxo2 gone?
I have o2 604 and i see that is now under folder tools
i always think that co2 is just for console programs ...
and i don't make console based programs with o2..
Hi Aurel,
gxo2 is the original compiler written in FreeBasic. co2 does the same job but it is self-compiled with OxygenBasic instead of freebasic, and has a few updated switches. co2m64 is almost identical to co2 but is 64bit compiled and uses oxygen64.dll. It is possible to use any of these with your IDE.
Quote. It is possible to use any of these with your IDE
Yes it is just add compiler path and work ;)
I used the 64bit dll to compile my two hexview.inc (http://forum.it-berater.org/index.php/topic,6065.0.html) demos.
So far so good.
Good job Charles...
It's gonna be my main compiler.
Note that, on my side, to avoid GPF, I had to use the last updated version of dialogs.inc (http://forum.it-berater.org/index.php?msg=26060)
The source code is almost identical for both 32bit and 64bit and I uncovered one bug which had escaped detection so far. It generated a negative array index, potentially corrupting a major buffer. It only became visible after a 64bit self-compile.
So I would recommend adopting version 070 for both 32bit and 64bit Oxygen dlls.
From what I understand, I can have only one O2 folder with coexisting both oxygen.dll & oxygen64.dll, and both co2.exe & co264.exe.
This bring rtl32/64.inc version conflict via "RTL version mismatches o2 version" 64bit dll is now rtlversion "0.7.0", 32bit dll is rtlversion "0.6.0".
I can rem the #error but I loose the version checking.
Is it correct to use this in rtl32/64.inc...
$ rtlversion "0.7.0"
$ rtlversion32 "0.6.0"
$ rtlversion64 "0.7.0"
'
#if not match(rtlversion32,o2version)
#if not match(rtlversion64,o2version)
#error "RTL version mismatches o2 version "+o2version
#endif
#endif
On more question, does the compiler result log file co2.txt will remain with this name or could become co264.txt for the 64bit dll?
Hi Pierre,
I checked inf/Oxylog and found the last change to the RTLs was in September 2019. (release 0.2.8). So it should be safe to override the version check.
I think the co2.txt name should remain. It is a very transient file that is created at the end of each compilation, so you have to catch it whenever you need a stable record of compilation stats.
If/when 64bit compilation becomes the norm we might change names, so co2 becomes 64bit and co32.exe wil become a 32bit legacy item.
Thanks, I will code my pre-compiler accordingly so I can go from one to the other in a snap.