Ahkdll load time

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: Ahkdll load time

03 Feb 2020, 00:47

A_LineFile Seems to be malfunctioning
win10-64 h2-64

Code: Select all

flux()

Code: Select all

; to lib dir
flux(this:="",tag:="",list*){
    static _f:=MsgBox(A_LineFile)
}
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Ahkdll load time

03 Feb 2020, 15:40

A_LineFile fixed, thanks for reporting.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Ahkdll load time

03 Feb 2020, 16:03

arcticir wrote:
02 Feb 2020, 22:11
I'm not sure which "object" you are talking about
ThreadObj.func("test","1") or ThreadObj.test(1) ;base.__call
But obviously both have big flaws.
So I use the example of passing data between processes in the "OnMessage ()" document, passing "ObjDump-objLoad" binary data between processes.
It can safely pass data between TLS-DLL-EXE, it can pass objects, return objects; it can make optional parameters take effect; it does not cause errors by passing 1 (instead of "1")
I usually use this custom function more, but I still hope that the built-in functions can achieve the same function with similar principles.
This would make it incompatible to other languages.
Are you looking for something like this:

Code: Select all

fun(ahk,name,param*) => (sz:=ObjDump(param,v),ObjLoad(HexToBin(bin,ahk.ahkFunction("fun",name,BinToHex(&v,sz))))[1])
ahk:=AhkThread("
(
#Persistent
fun(name,param) => (sz:=ObjDump([%name%(ObjLoad(HexToBin(bin,param))*)],v), BinToHex(&v,sz))

myfunc(p*){
  for k,v in p
    MsgBox 'param count: ' p.Length '``nparameter ' k ' = ' v
  return [1,2,3]
}
)")

for k,v in fun(ahk,"MyFunc","this","is", "a", "test", 1, 2, 3)
  MsgBox "Returned object from function:`n" k "=" v
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: Ahkdll load time

03 Feb 2020, 22:08

No. I did not read the AHK source code, but I do know that "ahkFunction-ahkPostFunction" uses window messages to pass binary data.
For example, the process of ahkPostFunction should be:

Code: Select all

func,param1-param9  => bin => send bin => bin => func,param1-param9
The scheme I am using is:

Code: Select all

objdump((func,param*),bin) => send bin => objLoad(bin) => func,param*
This is obviously very different from your example. Your example just proves that you can pass an object, but none of us actually use it (because of its efficiency), doesn't it?

I think this is only an internal change of "ahkFunction-ahkPostFunction" and will not cause compatibility issues.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Ahkdll load time

04 Feb 2020, 16:29

No, it uses internal array of FuncAndToken and only passes a pointer to it, so it does not copy any binary data and should be faster than using OnMessage-WM_COPYDATA.
In my example I pass an ObjDump->hex-string->ObjLoad and the same for return value.

The fastest is to call the function object:

Code: Select all

ahk:=AhkThread("
(
#Persistent

myfuncp:=&myfunc:=Func('myfunc')

myfunc(p*){
  for k,v in p
    MsgBox 'param count: ' p.Length '``nparameter ' k ' = ' v
  return [1,2,3]
}
)")
while !ahk.ahkgetvar("myfuncp")
	Sleep 100
myfunc:=Object(ahk.ahkgetvar("myfuncp")+0)
for k, v in myfunc.Call("this","is","a","test",1,2,3)
	MsgBox k "=" v
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: Ahkdll load time

04 Feb 2020, 16:37

I remember this method does not apply to TLS
Is it possible to use OnMessage-WM_COPYDATA for "ahkFunction-ahkPostFunction"?
ok, I give up and continue to use the old scheme.
HotKeyIt
Posts: 2364
Joined: 29 Sep 2013, 18:35
Contact:

Re: Ahkdll load time

04 Feb 2020, 16:57

If you face a problem using function object, let me know.
arcticir
Posts: 694
Joined: 17 Nov 2013, 11:32

Re: Ahkdll load time

09 Feb 2020, 09:05

I retract the negation of this example. It is at least three times faster than WM_COPYDATA. ;)
The only advantage of WM_COPYDATA is that it can transfer data across processes.

Code: Select all

fun(ahk,name,param*) => (sz:=ObjDump(param,v),ObjLoad(HexToBin(bin,ahk.ahkFunction("fun",name,BinToHex(&v,sz))))[1])
ahk:=AhkThread("
(
#Persistent
fun(name,param) => (sz:=ObjDump([%name%(ObjLoad(HexToBin(bin,param))*)],v), BinToHex(&v,sz))

myfunc(p*){
  for k,v in p
    MsgBox 'param count: ' p.Length '``nparameter ' k ' = ' v
  return [1,2,3]
}
)")

for k,v in fun(ahk,"MyFunc","this","is", "a", "test", 1, 2, 3)
  MsgBox "Returned object from function:`n" k "=" v

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 50 guests