Author Topic: DLLC  (Read 9030 times)

0 Members and 1 Guest are viewing this topic.

JRS

  • Guest
DLLC
« on: November 11, 2016, 02:44:05 PM »
Charles,

I tried to compile the DllcBuild.o2bas file but it doesn't create the DLLC.dll in modules and just flashes this dialog which looks like a hard coded path coming from somewhere.

John


.

Arnold

  • Guest
Re: DLLC
« Reply #1 on: November 12, 2016, 03:25:52 AM »
Hi John,

it seems that the path is coded into the new co2.exe. If I create the directory c:\cevp\code\oxygenbasic and copy oxygen.dll into this folder then compiling will work. Another way would be to compile with gxo2.exe, but:

@Charles - will gxo2.exe work the same way as co2.exe? Gxo2.exe has a date of 12/06/15 whereas co2.exe shows a date of 28/10/16.

Roland
« Last Edit: November 12, 2016, 04:57:59 AM by Arnold »

JRS

  • Guest
Re: DLLC
« Reply #2 on: November 12, 2016, 10:20:35 AM »
Thanks Roland for the info.

I'll wait until Charles has something stable for me to work with.


Charles Pegge

  • Guest
Re: DLLC
« Reply #3 on: November 13, 2016, 01:53:46 AM »

Hi John,

My directectory mappings differ from yours, so I have made DLLC building more generic. Put the contents of this zip into projectsC\ScriptBasic\.

You can adapt this batch file to you own system:
Code: [Select]
..\..\gxo2 DLLCbuild.o2bas
..\..\gxo2 DLLCtestDLL.o2bas
copy ..\..\Oxygen.dll  \ScriptBasic\modules
copy DLLC*.dll          \ScriptBasic\modules
pause
[/code]


.

Charles Pegge

  • Guest
Re: DLLC
« Reply #4 on: November 13, 2016, 02:01:02 AM »

Hi Roland,

co2.exe and gxo2.exe can be used the same way. co2 is more prone to unprovoked attacks from anti-virus software, otherwise it is my preferred compiler.

Arnold

  • Guest
Re: DLLC
« Reply #5 on: November 13, 2016, 04:23:32 AM »
Hi Charles,

I used BuildCo2.bat in folder tools to build co2 again, copied co2.exe to \OxygenBasic folder,  and now compiling will work with my system. But checking with a hex editor I see that there is still a difference between co2.exe and gxo2.exe:
co2.exe now points to c:\oxygenbasic\oxygen.dll, gxo2.exe points only to oxygen.dll. Co2.exe of the distribution before also points to oxygen.dll without path. How did you manage this?

Most probably I still have not understood the complete systematic of OxygenBasic. I read through -> Introducing Oxygen/Architecture and I am not sure if all of this is still valid. But I think the real strength lies in oxygen.dll, co2.exe and gxo2.exe are helper programs. So I could use e.g. an older co2.exe and will get the same results with oxygen.dll in the latest distribution?

BTW according to Applog.txt, Oxylog.txt you added a lot of new features to Oxygen. It will take some time to explore all the possible application spectrum. Is OxygenBasic still in Alpha stage? 

Roland

JRS

  • Guest
Re: DLLC
« Reply #6 on: November 13, 2016, 09:26:25 AM »
Quote
You can adapt this batch file to you own system:

Thanks Charles!

I tend to put all non-SB ext. mod DLL's in my Script BASIC bin directory as it''s in the Windows path and it keeps all my dependencies together in one place.

Can I now use DLLC quads for v7_val_t?

Update:

I gave your pre-compiled DLLC a try with my JS generic DLL and it exception errored trying to run a test of the O2 style FFI defines. (using q for the v7_val_t variable)
« Last Edit: November 13, 2016, 06:45:42 PM by John »

JRS

  • Guest
Re: DLLC
« Reply #7 on: November 13, 2016, 08:59:39 PM »
I'm getting close to wrapping up the first phase of the JS (JavaScript Engine) extension module for Script BASIC using C BASIC. I think I'm going to like Stringify.

Code: Script BASIC
  1. IMPORT js.inc
  2.  
  3. JS::CREATE
  4. myobj = JS::MK_OBJECT()
  5. JS::DEF(myobj, "myprop_1", 0, JS::MK_NUMBER(64))
  6. JS::DEF(myobj, "myprop_2", 0, JS::MK_NUMBER(1.23))
  7. JS::DEF(myobj, "myprop_3", 0, JS::MK_STRING("JavaScript"))
  8. PRINT JS::STRINGIFY(myobj, JS::JSON),"\n"
  9. JS::DESTROY
  10.  


jrs@jrs-laptop:~/sb/examples/js$ scriba js_stringify.sb
{"myprop_3":"JavaScript","myprop_2":1.23,"myprop_1":64}
jrs@jrs-laptop:~/sb/examples/js$

« Last Edit: November 13, 2016, 11:34:53 PM by John »

Charles Pegge

  • Guest
Re: DLLC
« Reply #8 on: November 14, 2016, 02:36:19 AM »
Hi Roland,

Gxo2 is compiled with Freebasic, whereas co2 is compiled with Oxygen and also uses a few o2 inc files, including sysutil, and parseutil so their internals will diverge. The compiler could be written in any language, and include customised preprocessing and postprocessing.

I think the full pathname that you see for oxygen.dll comes from librarypath "$\"

There is lots of new material in this release of o2, and I don't anticipate further major changes to the o2 core, but I see graphics, GUI and audio as major areas of interest for developing an outer shell.
« Last Edit: November 14, 2016, 02:50:59 AM by Charles Pegge »

Charles Pegge

  • Guest
Re: DLLC
« Reply #9 on: November 14, 2016, 03:25:41 AM »
Hi John,

Are you passing the quad value directly?
quads passed by reference are still interpreted as double. I have not followed thru yet

returned arrays should also be undefed before reuse. undef is a good precaution anyway.

Code: [Select]
ReturnQuadQ       = dllproc(mylib,"returnquadq q=(q value)" )
...
undef aq
aq[0]=7
aq[1]=9
ap=dllCall(returnquadQ,aq)
print "Return QuadQ: "  & ap[0] & "," & ap[1] &  "\n"

undef ap
ap=dllCall(returnquadQ,aq)
print "Return QuadQ: "  & ap[0] & "," & ap[1] &  "\n"

undef ar
ar=dllCall(returnquadQ,ap)
print "Return QuadQ: "  & ar[0] & "," & ar[1] &  "\n"

Arnold

  • Guest
Re: DLLC
« Reply #10 on: November 14, 2016, 03:40:10 AM »
Hi Charles,

thank you for the hint. I found the statement in sysuil.inc and commented it out for this special purpose. After running BuildCos2.bat again everything will run ok now. I think using the full path of oxygen.dll in co2.exe is a bit problematic if I change the folder's name of Oxygenbasic or use e.g. an usb stick. But now I know what I can do in a similar situation.

Roland

Charles Pegge

  • Guest
Re: DLLC
« Reply #11 on: November 14, 2016, 04:09:53 AM »
Yes, I see the problem. The library path to Oxygen gets 'baked' at co2 compile time. This librarypath line should be omitted. Thanks Roland.

JRS

  • Guest
Re: DLLC
« Reply #12 on: November 14, 2016, 09:25:15 AM »
I don't get how to assign a v7_val_t to a O2 quad and call a V7 function. How do I break up an unsigned long long into two 32 bit integer values? I'm confused!

JRS

  • Guest
Re: DLLC
« Reply #13 on: November 14, 2016, 09:48:20 AM »
OT

I stumbled upon a JavaScript interactive interpreter written in JavaScript. For me it's a good resource of advanced JavaScript techniques.

Quote
JS-Interpreter

A sandboxed JavaScript interpreter in JavaScript. Execute arbitrary JavaScript code line by line in isolation and safety.

Live demo

Documentation




Charles Pegge

  • Guest
Re: DLLC
« Reply #14 on: November 14, 2016, 10:11:25 AM »
Hi John,

All we are doing is splitting the 64 bit value into 2 32 bit values and storing them in an  array  of 2 integer elements. ar[0] has the lower 32 bits and ar[1] has the upper bits. This array can be passed around like a simple variable. The signed/unsigned status does not matter when you are only interested in bits.

SB array values are not contiguous internally so DLLC has to line them up before passing them to a DLL function

I have nearly finished Quads passed byref (q*) and Quads in data structures.