Error using _Struct Topic is solved

Post AHK_H specific scripts & libraries and discuss the usage and development of HotKeyIt's fork/branch
User avatar
Masonjar13
Posts: 1403
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Error using _Struct

09 Jul 2018, 17:02

Once again, issues while trying to update ScriptUp. The main change is offloading all the child threads to a child thread. The sequence is: main script > offload thread > many child threads. I've tested running a DLL thread from a DLL thread and I recall it working before. I'm still using _MemoryLibrary for this task, which uses _Struct. Specifically, I get Error: CONTINUABLE EXCEPTION_ACCESS_VIOLATION, which also states the mouse/keyboard hooks are disabled, the exception thread id, and line where the exception was thrown. Respective to the _Struct file on its own, it's line 530, which is

Code: Select all

else Return (new _Struct(pointer this["`t"],NumGet(this[""],"PTR")))[_field_]:=_value_
Is there something about this line that's incompatible with _H, or is it that I'm not able to run threads on threads using _MemoryLibrary?

Tried versions: 1.1.28.00-H008/1.1.29.01-H002
Main script: AHK_L 1.1.28.00

Everything is being tested on x64, using 64-bit versions.

Edit: forgot to mention: the error occurs on the offload thread, not the main script.
HotKeyIt
Posts: 1705
Joined: 29 Sep 2013, 18:35
Contact:

Re: Error using _Struct

18 Aug 2018, 16:14

I have not been using _MemoryLoadLibrary and _Struct for long now since it was build-in in _H long ago.
The error is for sure because of 0 pointer or error in _Struct, if you have a simple example I can take a look.

Btw. why are you not using AhkThread since you are using _H? Also there is Struct.
User avatar
Masonjar13
Posts: 1403
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: Error using _Struct

18 Aug 2018, 16:22

I haven't looked into _H's features, so I was simply trying to move what I already had over. If AhkThread is supported in the DLL's, I would agree that's a better way to go. Means I have to actually re-write it all from scratch though. I'll try it and see how it goes. :)
HotKeyIt
Posts: 1705
Joined: 29 Sep 2013, 18:35
Contact:

Re: Error using _Struct

19 Aug 2018, 07:12

Yes, this is supported and you don't even need a dll since it is included in exe.
Let me know if you have any problems ;)
User avatar
Masonjar13
Posts: 1403
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: Error using _Struct

19 Aug 2018, 19:04

Raises hand I have a problem. The main script is still going to be _L, where the threads need to be ran from a thread created with a DLL. Seems like the DLL doesn't support AhkThread(), keeps saying that it's a non-existent function. Puts me back where I started. Based off the structure I'm going for, changing the main script to _H wouldn't make any difference, unless that somehow enables AhkThread() on the new thread?
HotKeyIt
Posts: 1705
Joined: 29 Sep 2013, 18:35
Contact:

Re: Error using _Struct  Topic is solved

19 Aug 2018, 20:17

Yes AhkThread() uses by default the dll which sits in exe resources.
Otherwise you can use the DllToUse parameter to load a different dll. So if you are using _L you will be always using this parameter.
Btw for AHK_H v1 there is no Title parameter:

Code: Select all

ahkthread(script:="",parameters:="",ScriptIsFilePath:=0,DllToUse:="")
You can find the AhkThread script for v1 here.
User avatar
Masonjar13
Posts: 1403
Joined: 20 Jul 2014, 10:16
GitHub: Masonjar13
Location: Не Россия

Re: Error using _Struct

21 Aug 2018, 12:44

Ahh, didn't realize ahkThread() was AHK code. Seems to work perfectly, thanks HotKeyIt! Now I can get back to work :thumbup: Doing it this way makes the worker thread significantly lighter, library wise, which is a huge plus as well. Less management on my part :)

Return to “AutoHotkey_H”

Who is online

Users browsing this forum: No registered users and 3 guests