Does a standard DLL stay in memory?

G

Greg Lovern

If I declare a function in a standard DLL (not an ActiveX DLL) with
"Declare Function" (etc.), and then in the code make a call to that
function in the standard DLL, does the DLL stay in memory until Excel
exits?

Or is the standard DLL unloaded after each call to it?


Thanks,

Greg
 
P

Peter T

Why not have a look for yourself
xl97-2003 in WinXP
Help, About, System info, Software environment, loaded modules
xl2007
Excel Options, Resources, About, System info, loaded modules

Regards,
Peter T
 
J

Joel

I believe the DLL goes into swap space like most executables and data. it
will stay in memory until it is not needed any more and will be swapped out
of memory when another program requires the swap space. windows keep track
of the programs that are loaded in memory and will not re-open the dll if it
already is loaded into memory. You cannot guarantee that the file will stay
in memory or get swapped out of memory.

With some DLL's tht require a memory block for input or output you can
declare the required memory in your macro so it doesn't get lost for each DLL
call.

For example if you use Memorycopy. The DLL will copy a block of memory.
You specify the where in memory the input and output will goes. The actuall
DLL is an executable that has no required memory space. The executable part
of the DLL may get swapped out of memeory but the actual data that gets moved
is part of the macro and doesn't get lost.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top