Jump to content
Sign in to follow this  
Rickname

Any advantages of using DllOpen ??

Recommended Posts

Rickname

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

Share this post


Link to post
Share on other sites
jchd

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)

Share this post


Link to post
Share on other sites
FireFox

Your topic reminds me


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Rickname

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

Share this post


Link to post
Share on other sites
jchd

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.

  • Like 1

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)

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
Rickname

Yes it is.

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 ?

Edited by Rickname

Share this post


Link to post
Share on other sites
UEZ

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!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
JohnOne

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.
  • Like 1

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

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
jchd

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)

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.