Author Topic: DLLC status  (Read 4467 times)

0 Members and 1 Guest are viewing this topic.

jack

  • Full Member
  • ***
  • Posts: 154
Re: DLLC status
« Reply #30 on: May 10, 2020, 05:07:48 AM »
Jack,

Are you using the latest version of FreeImage?
yes, version 3.18 and O2H 0.2.9 2020-04-21T14:29:11
I suspect that there's a way to write the program so that it will compile on either 32 or 64-bit, perhaps Arnold or Aurel could help with that
« Last Edit: May 10, 2020, 05:21:55 AM by jack »

John

  • Hero Member
  • *****
  • Posts: 3683
Re: DLLC status
« Reply #31 on: May 10, 2020, 05:37:33 AM »
I thought calling _FreeImage_Initialise@4 might help but no joy.  :(

Code: C
  1. #if defined(__MINGW32__) && defined(_WINDOWS_H)
  2. #define _WINDOWS_       // prevent a bug in MinGW32
  3. #endif // __MINGW32__
  4.  

My guess at this point is FreeImage can no longer be called via FFI due to structures or defines not preset.

I tried version 3.13 (2009) and it still doesn't work. Not sure what changed in O2?
« Last Edit: May 10, 2020, 06:08:45 AM by John »

John

  • Hero Member
  • *****
  • Posts: 3683
Re: DLLC status
« Reply #32 on: May 10, 2020, 07:09:29 AM »
I gave DYC (what DLLC replaced) a try and it returns a string pointer to the FreeImage version return string.

This eliminates FreeImage, ScriptBasic and O2 native. (based on Jack's positive results with O2)

Looks like a bug in DLLC using the latest O2 build.

Code: Script BASIC
  1. DECLARE SUB DLL ALIAS "dyc" LIB "dyc"
  2.  
  3. PRINT DLL("mc,p,freeimage.dll,_FreeImage_GetVersion@0,P",0),"\n"
  4.  


C:\ScriptBASIC\examples>sbc testfi.sb
270788360

C:\ScriptBASIC\examples>


Here is the DLLC code that is failing with FreeImage.dll.

Code: OxygenBasic
  1.   function dllproc (sys pSt, ppModuleInternal, pParameters, pReturnValue) as sys
  2.   ==============================================================================
  3.   '
  4.  sys oa
  5.   string ms
  6.   '
  7.  if pParameters=0
  8.     exit function
  9.   end if
  10.   '
  11.  CountParams pParameters,c
  12.   '
  13.  if c<2
  14.     exit function
  15.   elseif c>=3
  16.     pm=GetParamPtr pparameters,3 'DIRECT CALL ADDRESS
  17.    oa=GetLongParam pst,pm
  18.   end if
  19.   '
  20.  e++
  21.   ll[e].metatype=2 'metatype PROCEDURE CALLS=2
  22.  '
  23.  pm=GetParamPtr pparameters,2
  24.   s=GetStringParam pst,pm
  25.   '
  26.  readentityspec 'encode and store the prototype
  27.  '
  28.  pm=GetParamPtr pparameters,1
  29.   a=GetLongParam pst,pm
  30.   if a=0
  31.     errors+= "library not found for " ll[e].name cr
  32.     errn++
  33.     e--
  34.     exit function
  35.   end if
  36.   '
  37.  if oa
  38.     ll[e].library=0
  39.     ll[e].handle=oa 'specify call address
  40.    a=e
  41.   else
  42.     ll[e].library=a
  43.     if a then
  44.       ll[e].handle=GetProcAddress ll[a].handle, ll[e].name
  45.       a=e
  46.     end if
  47.   end if
  48.   if ll[e].handle=0
  49.     errors+="procedure not located: " ll[e].name cr
  50.     e--
  51.     errn++
  52.     a=0
  53.   end if
  54.   *pReturnValue=ReturnLong(pst,a)
  55.   '
  56.  end function
  57.  



Charles Pegge

  • Admin Support Member
  • *****
  • Posts: 4326
    • Oxygen Basic
Re: DLLC status
« Reply #33 on: May 10, 2020, 11:27:56 AM »
Hi John,

It was the mangled names :(

I've fixed this in dllc: sbutil.inc getword(). ascii 64 '@'

Also, If the dll is located in the exepath, the system should find it without a full path name.

John

  • Hero Member
  • *****
  • Posts: 3683
Re: DLLC status
« Reply #34 on: May 10, 2020, 12:29:20 PM »
Thank you Charles!

Glad this is behind us.

FYI: I had to declare a few for variables in the examples. It seems O2 is more picky about type definitions. At least in functions.

Works great by just replacing my extension module with your compiled dllc.dll that came in the zip.

Can't be happier. An open ended easy to use scripting engine with a kickass JIT BASIC compiler seamlessly embedded.
« Last Edit: May 10, 2020, 04:49:11 PM by John »

John

  • Hero Member
  • *****
  • Posts: 3683
Re: DLLC status
« Reply #35 on: May 11, 2020, 07:19:23 AM »
My next goal is to use DLLC to create virtual callback functions for both IUP and the COM/OLE automation based WSO GUI toolkit.

Any suggestions or examples are welcome.

John

  • Hero Member
  • *****
  • Posts: 3683
Re: DLLC status
« Reply #36 on: May 11, 2020, 09:02:04 AM »
In theory, I would like to define standard callback functions based on the event and keep an array of controls that subscribe to them. The callback would lookup the control ID in the array and do a SB function call in the case of IUP or return the C function callback address for the WSO GUI toolkit.

The current VB6 OCX form callbacks work in this way with ScriptBasic. I would like to provide the same strategy for IUP and WSO.
« Last Edit: May 11, 2020, 09:23:58 AM by John »

John

  • Hero Member
  • *****
  • Posts: 3683
Re: DLLC status
« Reply #37 on: May 12, 2020, 06:41:54 AM »
The ScriptBasic VB6 OCX form example I did is a good example of solving the callback delemia. Before the form is shown, ScriptBasic via its COM extension assigns values to a collection which the OCX uses to call the right ScriptBasic function/ sub.