Jump to content

Any advantages of using DllOpen ??


Recommended Posts

Do you guys know why or when to use "DllOpen" ( opening the needed dll ) before calling a function via DllCall ?

Why I think that its still a good idea :

- because errors or problems can appear when multiple calls of the same function ( eg. in a loop ) are made

- because next time when calling the same function or other functions from the same dll can be more faster ?

Am I right ? :ermm:

Edited by Rickname
Link to comment
Share on other sites

DllOpen may have to perform a full load of things behind the hood and it's a slow operation. While it won't make any difference for basic system DLLs already loaded (~ no work to do) or if you DllCall a named DLL only once in a while, it makes a dramatic difference when DllCalling repeatedly a DLL by name which isn't already in use by the process.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

DllOpen may have to perform a full load of things behind the hood and it's a slow operation. While it won't make any difference for basic system DLLs already loaded (~ no work to do) or if you DllCall a named DLL only once in a while, it makes a dramatic difference when DllCalling repeatedly a DLL by name which isn't already in use by the process.

Your topic reminds me

So if I have

While $timerdiff < 5000
DllCall("user32.dll".....)
Wend

its still a better (faster) idea to put DllOpen a dll before that "While" loop ? Or the PC will have more things to process and will be slower ? I'm little confused :huh:

Edited by Rickname
Link to comment
Share on other sites

user32.dll is one of the system DLLs which are always loaded for AFAIK every process, at least those doing significant work.

Here the only difference will be to parse the DLL path, look it up in the list of loaded DLLs and retrieving the handle it has (gory details skipped). That means almost nothing.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

So if I have

While $timerdiff < 5000
DllCall("user32.dll".....)
Wend

its still a better (faster) idea to put DllOpen a dll before that "While" loop ? Or the PC will have more things to process and will be slower ? I'm little confused :huh:

Yes it is.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I assume that a DllOpen() will load the full or a part from the DLL into the memory which is faster to call instead of loading the DLL each time on a DLLCall.

But I don't know how the os handle DLLs which are permantly used by apps. It might be that those DLLs are also cached in the memory.

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

But just like @jchd said , the user32 library is used by absolutely so many processes, then its almost useless to open it with autoit too, no ?

Yes, but as jchd also said, if you don't open it first, autoit will have to look through a list of already loaded dll files to see if it is open and retrieve a handle to it each time you call it.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Ummm, I believe it's rather the OS job to do that. It's also responsible for invoking the DLL init function and such.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...