Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#858 possible bug in rxfuncdrop()

v4.0.1
closed
Rick McGuire
5
2012-08-14
2009-11-09
No

ooRexx 4.0.0, Win XP Pro SP3 on x86

I experimented trying to get a non-rexx routine in a DLL to work from rexx. This failed, with rexx dumping. Once I was told that only rexx functions in DLLs could be rxfuncadd()-ed etc I was happy about that. (This is described in comp.lang.rexx thread "Problems with a DLL in ooRexx 4.0.0 under Windows XP" started on 2nd Nov 2009.)

However in my experiments I was a little unsure of the significance of the different parameters to rxfuncadd(). So after having made my rxfuncadd() call, I tested various putative function names via rxfuncquery(), expecting only one of them to work. That was what happened. I then issued rxfuncdrop() to get rid of my external function definition (in fact I did so for all my 'test' function names). All of these calls returned the same return code, which seemed odd to me as I expected only the one that corresponded to the successful definition to be droppable. So I issued more rxfuncquery() calls, and they showed the same results as before the rxfuncdrop() calls.

Although the 'external function' I was trying to define was not a rexx one, it seems to me that even if the add only worked in the sense that a function name & the address of its definition got added to a lookup table, surely the drop should have been able to discard that info?

The code I used and its output were as follows:

md5dllnm = "MDFile" / function name as defined inside DLL /
md5dllrx = "rxMD5" / name I'll use for it in this rexx exec /
md5dllpt = "C:\Program Files\~A-folder\AutoPatcher\bin\aamd532.dll"

findadll = rxfuncadd(md5dllrx,md5dllpt,md5dllnm)
say "funcadd rc="findadll "(0=ok, 1=err)"

That shows a rc of 0 each time I run it, so I suppose it worked. I then tried querying 4 function names, three of which I expected the exec not to be able to find. In particular I was trying to show that the function name that rexx would now recognise was the 'rx' one rather than the 'nm' value:

q.1 = "rxwibble"
q.2 = md5dllrx / hopefully this one will work /
q.3 = md5dllnm
q.4 = "rxwobble"
q.0 = 4

do qq = 1 to q.0
qqthname = q.qq
queryfnm = rxfuncquery(qqthname)
say " rxfuncquery for name:" right(qqthname,12) "was:" queryfnm
end

which produces:

rxfuncquery for name: rxwibble was: 1
rxfuncquery for name: rxMD5 was: 0
rxfuncquery for name: MDFile was: 1
rxfuncquery for name: rxwobble was: 1

which I think means I have managed ok to define "rxMD5" as a function as far as rexx is concerned.

Learning one step at a time, I thought I'd next try to drop the four functions (or at least one function and three irrelevant names), in which I expected to get one success and three failures, but that didn't happen, so I followed this by 4 more queries to see if the drops had done anything:

do qq = 1 to q.0
qqthname = q.qq
dropfunc = rxfuncdrop(qqthname)
say " rxfuncdrop for name:" right(qqthname,12) "was:" dropfunc
end
say

do qq = 1 to q.0
qqthname = q.qq
queryfnm = rxfuncquery(qqthname)
say " rxfuncquery for name:" right(qqthname,12) "was:" queryfnm
end
say

which produces:

rxfuncdrop for name: rxwibble was: 1
rxfuncdrop for name: rxMD5 was: 1
rxfuncdrop for name: MDFile was: 1
rxfuncdrop for name: rxwobble was: 1

rxfuncquery for name: rxwibble was: 1
rxfuncquery for name: rxMD5 was: 0
rxfuncquery for name: MDFile was: 1
rxfuncquery for name: rxwobble was: 1

Does this mean that none of the rxfuncdrop calls worked?

Discussion


Anonymous


Cancel   Add attachments