#DllLoad proper usage with utility class
#DllLoad proper usage with utility class
What is the proper usage of #DllLoad in a class that uses a Dll? Especially if you want the consumer to be able to pass the path to the Dll. Are there concerns/issues with calling #DllLoad multiple times with the same Dll?
Re: #DllLoad proper usage with utility class
I would think that might depend on the DLL. Is the DLL meant to be loaded into multiple instances of itself?
Hopefully the DLL is documented in a way where it is easy-ish to manage instances (assuming it is meant to be spawned that way). Maybe it's meant to be loaded once, and then a built in function/method would then load another instance?
What's the DLL to be loaded?
Hopefully the DLL is documented in a way where it is easy-ish to manage instances (assuming it is meant to be spawned that way). Maybe it's meant to be loaded once, and then a built in function/method would then load another instance?
What's the DLL to be loaded?
« AHK Portable Installer » | « CallTipsForAll » | « TheArkive AHK v1 Scripts » | « TheArkive AHK v2 Scrpts » | « TheArkive on GitHub »
Re: #DllLoad proper usage with utility class
Its Scintilla. So the Dll only needs to be loaded once per AHK process. But I don't think the #DllLoad should be included in the class that wraps the control. I could probably use the asterisk to avoid issues if the class is included more than once. But then the consumer can't provide the path to the Dll.
Re: #DllLoad proper usage with utility class
Ah good point.
Funny, i've been thinking of getting back to scintilla myself...
I thought your original script class had a way to pass a specific path already? Any reason in particular why it should be done through #DllLoad?
I would think that in the case of a class script, it is more important to rely on the customer know how to use it, more so than "too much dummy-proofing". Unless, i'm missing a finer point..?
Funny, i've been thinking of getting back to scintilla myself...
I thought your original script class had a way to pass a specific path already? Any reason in particular why it should be done through #DllLoad?
Code: Select all
__New(gui, opts := "", DllPath := "Scintilla.dll", Style := 0x50010000, ExStyle := 0x200) {
« AHK Portable Installer » | « CallTipsForAll » | « TheArkive AHK v1 Scripts » | « TheArkive AHK v2 Scrpts » | « TheArkive on GitHub »
Re: #DllLoad proper usage with utility class
Makes sense. But I think that is sacrificing performance optimizations by calling #DllLoad and calling the functions by name.
Re: #DllLoad proper usage with utility class
If you manage to squeeze more performance out of scintilla with any method, I'd be interested I still have some experiments to do with custom syntax highlighting.
« AHK Portable Installer » | « CallTipsForAll » | « TheArkive AHK v1 Scripts » | « TheArkive AHK v2 Scrpts » | « TheArkive on GitHub »
Re: #DllLoad proper usage with utility class
You can only load a dll once, if I'm not mistaken (disregarding copies). Using #dllload or LoadLibrary() on the same dll multiple times will not create new "instances" of it.
I think I would design a class/library with the assumption that the programmer using it loads the dll as it prefers. This could also require the programmer to delete a #dllload if it doesn't want to use it .
Cheers.
Is the consumer a programmer using the class or a user of a program?you want the consumer to be able to pass the path to the Dll.
I think I would design a class/library with the assumption that the programmer using it loads the dll as it prefers. This could also require the programmer to delete a #dllload if it doesn't want to use it .
Cheers.
Who is online
Users browsing this forum: aybracers and 55 guests