News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Question about dlls

Started by Rainstorm, October 26, 2006, 12:09:18 AM

Previous topic - Next topic

Rainstorm

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 ?

-------

PBrennick

They look okay to me. I usually avoid using words such as data though that is just personal preference.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Tedd

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

No snowflake in an avalanche feels responsible.

PBrennick

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

The GeneSys Project is available from:
The Repository or My crappy website