Author Topic: DLLC Windows 7  (Read 2852 times)

0 Members and 1 Guest are viewing this topic.

JRS

  • Guest
DLLC Windows 7
« on: April 26, 2014, 11:57:01 AM »
Charles,

Are you on an e-mail sabbatical?

I'm having a problem with DLLC under Windows 7 where I'm getting a false error message saying the DLL(s) can't be found even though they are loaded and the script runs as expected. I took a quick peek at the dllfile() function and the first thing that caught my eye is that e isn't define, passed as an argument and is assumed to be the end value for the FOR/NEXT.

Code: [Select]
  function dllfile (sys pSt, ppModuleInternal, pParameters, pReturnValue) as sys
  ==============================================================================
  '
  c=0
  if pParameters
    CountParams pParameters,c
  end if
  '
  if c=0
    for i=1 to e
      if ll[i].metatype=1
        freelibrary ll[i].handle
      end if
    next
    exit function
  end if
  '
  e++
  ll[e].metatype=1 'metatype LIBRARY=1
  '
  pm=GetParamPtr pparameters,1
  ll[e].name=GetStringParam pst,pm
  ll[e].handle=LoadLibrary ll[e].name
  if ll[e].handle=0
    print "DLL File not located: " ll[e].name
  end if
  blib=e
  '
  *pReturnValue=ReturnLong(pst,e) 'return the library handle
  '
  end function

Charles Pegge

  • Guest
Re: DLLC Windows 7
« Reply #1 on: April 26, 2014, 12:28:53 PM »

Hi John,

e has global scope and indexes the final DLLC entity record.

Is this problem specific to Windows 7? This function relies on the OS and/or the file pathname to locate DLLs - no special tricks.

Unfortunately email is not a good medium for me, - dealing with software.

JRS

  • Guest
Re: DLLC Windows 7
« Reply #2 on: April 26, 2014, 12:32:08 PM »
Works fine on XP.  Seems to be SysWOW64 thing.  :(

JRS

  • Guest
Re: DLLC Windows 7
« Reply #3 on: April 26, 2014, 02:43:58 PM »
I'm just going to remark out the check for the handle being zero. Works otherwise.

dllfile
Code: [Select]
' if ll[e].handle=0
'   print "DLL File not located: " ll[e].name
' end if

dllproc
Code: [Select]
' if ll[e].handle=0
'   print "procedure not located: " ll[e].name
'   errors+="procedure not located: " ll[e].name cr
'   errn++
' end if

« Last Edit: April 26, 2014, 02:56:21 PM by John »

JRS

  • Guest
Re: DLLC Windows 7
« Reply #4 on: April 27, 2014, 02:13:45 PM »
Charles,

What is the procedure for creating a 64 bit O2 DLL? I would like to start migrating the DLLC extension module to 64 bit with a primary focus on Script BASIC IUP multi-threading support.

John

Update

Noticed this on Jose Roca's forum. This works so I'll see how far I get.  :o

Code: [Select]
  '
  $dll
  $filename "t64.dll"
  #include "..\..\inc\RTL64.inc"


  print "t64.dll Loaded"

  function HelloA(string s) as string, export
    return "HelloA "+s
  end function

  function HelloW(wstring s) as wstring, export
    return "HelloW "+s
  end function

Code: [Select]

  $filename "TestHello64.exe"
  #include "..\..\inc\RTL64.inc"


  declare function HelloA lib "t64.dll" (string s) as string
  declare function HelloW lib "t64.dll" (wstring s) as wstring

  print HelloA "World!"
  print HelloW "World!"
« Last Edit: April 27, 2014, 02:43:31 PM by John »

JRS

  • Guest
Re: DLLC Windows 7
« Reply #5 on: April 27, 2014, 02:52:00 PM »
I haven't tested it yet but DLLC compiled without error with the O2 64 bit runtime.


JRS

  • Guest
Re: DLLC Windows 7
« Reply #6 on: April 27, 2014, 04:24:21 PM »
 :-\

It gets through all the SB DECLAREs but dies on dllfile.

Does there need to be a 64 bit version of oxygen.dll for this to work? The reason I ask is I think oxygen.dll is used in DLLC. (virtual DLL)

Does the IUP / multi-threading require oxygen.dll support? What would I need to gut to eliminate the need for a 64 bit oxygen.dll?
« Last Edit: April 27, 2014, 05:17:02 PM by John »

Charles Pegge

  • Guest
Re: DLLC Windows 7
« Reply #7 on: April 27, 2014, 07:05:57 PM »
Hi John,

Once DLLC is compiled, it has no further dependency on Oxygen.dll.

I've done much of the ground work, for the 64 bit version. There are still a few unknowns on the SB side which are best resolved by testing. But even using RTL64, the current DLLC will never work, due to the requirement for using the MS64 calling convention, when relaying calls to a DLL. And the only sensible way of hacking this protocol is raw machine code - JIT.

JRS

  • Guest
Re: DLLC Windows 7
« Reply #8 on: April 27, 2014, 07:14:29 PM »
Quote
Once DLLC is compiled, it has no further dependency on Oxygen.dll.

That may be true for standard O2 DLLs but DLLC is explicitly calling oxygen.dll.

Maybe you can use the scriba API for loading 64 bit DLLs. I'm not having any issues loading 64 bit versions of the IUP DLLs with my IUP extension module.

Please ping me when you have something for me to test.

Thank You !!!

 
« Last Edit: April 27, 2014, 07:42:42 PM by John »

Charles Pegge

  • Guest
Re: DLLC Windows 7
« Reply #9 on: April 27, 2014, 08:13:24 PM »

When a program includes RTL32 or RTL64, it compiles without any links to Oxygen.dll. Both of these libraries switch compilation to an 'independent' mode, and insert all the run-time core functions into the binary. (about 12/16kb of code.)

Some of the earlier examples used Oxygen.dll to JIT-compile routines for SB, but DLLC does not do this itself.

Code: [Select]
  $ dll
  $ Filename "c:\ScriptBasic\modules\dllc.dll"
  include    "$\inc\RTL32.inc"
  include    "sbo2util.inc"

JRS

  • Guest
Re: DLLC Windows 7
« Reply #10 on: April 27, 2014, 08:26:40 PM »
Thanks Charles for the explanation. I thought I remembered in DLLC code it doing the JIT stuff by calling oxygen.dll.

I just removed the oxygen.dll from the SB modules directory and everything works fine with DLLC. (32 bit)  Nice to know!
« Last Edit: April 27, 2014, 08:52:22 PM by John »