Page 1 of 1

How can I tell if a "dll handle" is available?

Posted: 15 Apr 2019, 09:19
by arcticir
This is an old problem that has existed for at least two years. I have feedback to you before.
I can't provide a test script because it has a low chance of appearing, but sometimes it happens frequently.
It always appears here:

Code: Select all

o.ahktextdll[code,,pi.name " & " pi.id]
I tried a lot of judgments, but it still didn't work:

Code: Select all

	o:=ahkdll()
	if isobject(o) and type(o.new)="DynaCall" and o.ready[]!=""
		if o.ahktextdll[code,,pi.name " & " pi.id]
			out:=pi.id
https://img01.sogoucdn.com/app/a/100520146/9B7B2E19F0B78A409A8E469B8EB653F6&oname=20190415220629.png
Image

Re: How can I tell if a "dll handle" is available?

Posted: 15 Apr 2019, 14:55
by HotKeyIt
Can you try putting this into a variable and also check the result of it when it fails: pi.name " & " pi.id

Re: How can I tell if a "dll handle" is available?

Posted: 16 Apr 2019, 02:01
by arcticir
HotKeyIt wrote:
15 Apr 2019, 14:55
Can you try putting this into a variable and also check the result of it when it fails: pi.name " & " pi.id
If it is wrong, it should be a regular error, not a "crash" error.
I will try.

Re: How can I tell if a "dll handle" is available?

Posted: 16 Apr 2019, 03:35
by arcticir
Invalid: :(

Code: Select all

Error: CONTINUABLE EXCEPTION_ACCESS_VIOLATION

Mouse and Keyboard hooks have been disabled.

  -  Press yes to exit thread and continue execution.
  -  Press no to continue thread (debug).
  -  Press cancel to exit application.

Exception was caused in thread id: 2620
Line: 429
Specifically: .new[code,,s]
LineFile: D:\float\Aurora\Lib\alga.ahk

Re: How can I tell if a "dll handle" is available?

Posted: 16 Apr 2019, 14:28
by HotKeyIt
Sorry but I will need an example :(

Re: How can I tell if a "dll handle" is available?

Posted: 17 Apr 2019, 00:33
by arcticir
This is an example of a constant reboot. On my computer, within 10 seconds, it will go wrong.

https://drive.google.com/open?id=1hbfV6dhTwpxELgaVjwIkYnSalT_JM_R6

Re: How can I tell if a "dll handle" is available?

Posted: 17 Apr 2019, 15:01
by HotKeyIt
Can you try if it fails if you only redo the procedure including loading a new dll and threads without restarting, not sure how to debug restarting exe :(
If it fails too, please upload new example. Thank you ;)

Re: How can I tell if a "dll handle" is available?

Posted: 17 Apr 2019, 15:40
by arcticir
Sorry, this problem can only be reproduced with frequent restarts because the chances of reproduction are low.

Maybe you can try "debug" on the "restart" code:

Code: Select all

;test\script\test.ahk
run "debug.exe " A_AhkPath  ;run A_AhkPath
ProcessClose(ProcessExist())
=============
Found a new problem, it seems that only up to 59 DLL threads can now be loaded:

Code: Select all

dll:=fileread(a_ahkdir "\AutoHotkey.dll","raw")

loop 100
if !r:=MemoryLoadLibrary(&dll)
MsgBox a_index

Re: How can I tell if a "dll handle" is available?

Posted: 17 Apr 2019, 17:24
by HotKeyIt
Can't do it that way.
The 59 dlls problem does not exist for me, I can load 1000+ dlls

Re: How can I tell if a "dll handle" is available?

Posted: 17 Apr 2019, 18:16
by arcticir
try Win32w_MT

Re: How can I tell if a "dll handle" is available?

Posted: 17 Apr 2019, 18:29
by arcticir
I switched from Win32w_MT to Win32w. Strangely, the low random error disappeared.
The test script restarts the test for a long time and is still normal.
This is really strange.

Re: How can I tell if a "dll handle" is available?

Posted: 18 Apr 2019, 15:18
by HotKeyIt
MT is not multithreading compatible between exe and dll or dll and dll!!!

Re: How can I tell if a "dll handle" is available?

Posted: 19 Apr 2019, 13:20
by arcticir
Can you describe the "MT version" in detail?

Re: How can I tell if a "dll handle" is available?

Posted: 19 Apr 2019, 14:34
by HotKeyIt

Re: How can I tell if a "dll handle" is available?

Posted: 19 Apr 2019, 17:20
by arcticir
Thanks. ;)