The MASM Forum Archive 2004 to 2012

Project Support Forums => The GeneSys Development System => Topic started by: Rainstorm on October 26, 2006, 12:09:18 AM

Title: Question about dlls
Post by: Rainstorm on October 26, 2006, 12:09:18 AM
hi just have some questions about the dll format

testrun proc mWnd:DWORD,aWnd:DWORD,data:DWORD,parms:DWORD,show:BOOL,nopause:BOOL
LibMain proc instance:DWORD,reason:DWORD,unused:DWORD


could you confirm this for me..
are things like data, mWnd,instance, params, unused etc variables like the usual ones.. or can be
treated like variables , as such ?

-------
Title: Re: Question about dlls
Post by: PBrennick on November 02, 2006, 12:07:37 PM
They look okay to me. I usually avoid using words such as data though that is just personal preference.

Paul
Title: Re: Question about dlls
Post by: Tedd on November 03, 2006, 12:50:46 PM
They're arguments, just as in any 'normal' function.

What Paul means is that 'data' is used by masm as a keyword, and though you might get away with it in this case, try to avoid using keywords for argument/variable names. "value" would work just as well?

General dll startup code.. (this is what you've named LibMain)
DllEntry proc hInstance:HINSTANCE,reason:DWORD,reserved1:DWORD
    mov eax,reason
    .IF (eax==DLL_PROCESS_ATTACH)
        ;return TRUE to continue loading, or FALSE to abort
    .ELSEIF (eax==DLL_PROCESS_DETACH)
    .ELSEIF (eax==DLL_THREAD_ATTACH)
    .ELSEIF (eax==DLL_THREAD_DETACH)
    .ENDIF
    mov eax,TRUE
    ret
DllEntry endp

Title: Re: Question about dlls
Post by: PBrennick on November 03, 2006, 02:21:50 PM
BTW, the last to lines in Tedd's example are not a convenience they are a requirement.

    mov eax,TRUE
    ret

Also, remember the DEF file. The DLL will not know what to export without it so if it doesn't exist, the DLL will not work which will cause one to think there is an error in the assembly. This error will drive most people absolutely crazy!  :red

Paul