The MASM Forum

General => The Campus => Topic started by: jeivarmarr on March 24, 2013, 05:34:50 AM

Title: Help freelibrary
Post by: jeivarmarr on March 24, 2013, 05:34:50 AM
Good day,

this is to request help,
I need to create a dll that unload itself when you finish your work,

I've used it.

. data
  Libname db "MiDLL.dll", 0

invoke LoadLibrary, addr Libname
. if eax != NULL
Invoke FreeLibrary, eax
. endif

but I have problems I closed the process has loaded the dll :dazzled:
Title: Re: Help freelibrary
Post by: jj2007 on March 24, 2013, 05:54:42 AM
We are very bad at reading your thoughts. Post your complete code please.
Title: Re: Help freelibrary
Post by: dedndave on March 24, 2013, 06:34:42 AM
your DLL should have a DllMain entry point proc
it handles loading and unloading, init and uninit, and returns appropriate values

http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583%28v=vs.85%29.aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583%28v=vs.85%29.aspx)

DLL_PROCESS_ATTACH, DLL_PROCESS_DETACH, DLL_THREAD_ATTACH, DLL_THREAD_DETACH

refer also to the example in masm32\examples\exampl01\dll