Oxygen Basic
Programming => Problems & Solutions => Topic started by: JRS 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.
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
-
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.
-
Works fine on XP. Seems to be SysWOW64 thing. :(
-
I'm just going to remark out the check for the handle being zero. Works otherwise.
dllfile
' if ll[e].handle=0
' print "DLL File not located: " ll[e].name
' end if
dllproc
' if ll[e].handle=0
' print "procedure not located: " ll[e].name
' errors+="procedure not located: " ll[e].name cr
' errn++
' end if
-
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
'
$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
$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!"
-
I haven't tested it yet but DLLC compiled without error with the O2 64 bit runtime.
-
:-\
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?
-
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.
-
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 !!!
-
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.
$ dll
$ Filename "c:\ScriptBasic\modules\dllc.dll"
include "$\inc\RTL32.inc"
include "sbo2util.inc"
-
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!