The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Rainstorm on September 17, 2006, 09:24:41 AM

Title: Question about PROTO format in DLL
Post by: Rainstorm on September 17, 2006, 09:24:41 AM
Hi.

In all the formats for Prototypes I've seen it like this
PROTO :DWORD,:DWORD,:DWORD

I was going through the dlltute.asm file & there the prototypes are like this

MessageBoxSTD PROTO STDCALL :DWORD,:DWORD,:DWORD,:DWORD,:DWORD

also the corresponding procedure line

MessageBoxSTD proc STDCALL hParent:DWORD,lpMsg:DWORD,
              lpTitle:DWORD,dlgStyle:DWORD,iconID:DWORD

both have the extra calltype name STDCALL in their format, after the word Proto.

could someone tell me something about that.

is that to be followed only for dlls ?

also, for proc & protos its okay for the statements to trail into the next line

thanks.

-
Title: Re: Question about PROTO format in DLL
Post by: hutch-- on September 17, 2006, 12:13:59 PM
The prototype format in masm32 assumes that your app has the default prototype set to STDCALL like the following.


      .486                      ; create 32 bit code
      .model flat, stdcall      ; 32 bit memory model
      option casemap :none      ; case sensitive


All you need to change with prototypes is if you use a C calling convention where you write it like this.


MyProc PROTO C :DWORD,:DWORD, etc ....
Title: Re: Question about PROTO format in DLL
Post by: zooba on September 17, 2006, 01:08:44 PM
And the statement can continue onto the next line if the first line ends in a comma or backslash. MASM assumes that there has to be more items following the comma, so it keeps looking, and the backslash is defined as the line-continuation character, which means MASM treats both lines as one. Note that there is a limit on line length (around 255 characters I think) which includes whitespace, so don't continue too much :wink

Cheers,

Zooba :U
Title: Re: Question about PROTO format in DLL
Post by: sihotaamarpal on September 17, 2006, 05:29:57 PM
hi rainstorm,

   proto c or proto stdcall or proto pascal r the calling conventions

   proto c: reads parameters from right to left and pushed to stack,this is useful when u does,nt know the no. of parameters
               passed to yur procedures

   proto pascal:is oposite to c,left to right where no of parameters list remain constant

   proto stdcall:combines c and pascal

@@:
regards
sihota



 
             
Title: Re: Question about PROTO format in DLL
Post by: Rainstorm on September 17, 2006, 05:44:26 PM
hutch wrote..
QuoteThe prototype format in masm32 assumes that your app has the default prototype set to STDCALL like the following.
So that's an assumed part of the statement that needs
to be specified only if it is something diff...makes more sense now.

:thumbu for the extra info sihotaamarpal

zooba thanks for the info. - that clears it up for me.
-
Title: Re: Question about PROTO format in DLL
Post by: Rainstorm on September 17, 2006, 08:20:40 PM
hi.

thought i'd just ask this here instead of starting another thread.

are there some functions documented in the masm32 help files which can be used only by
including masm32rt.inc ?
include \masm32\include\masm32rt.inc

what i mean is can these functions be accessed & used by including some other files or are they
only available through masm32rt.inc

also I see the str$() function in examples but can't find it in the masm help files
i found ustr$ though
is str$ an old function or something ?


ty

-
Title: Re: Question about PROTO format in DLL
Post by: PBrennick on September 17, 2006, 08:31:29 PM
Rainstorm,
The purpose of masm32rt.inc is to simplify your coding.  At the beginning of each source there are a series of directives, commonly used include files and commonly used libraries.  There is nothing magical about it and it does nothing else.  It is a good idea to use it because it makes life easier for you but it is in no way necessary.

Paul
Title: Re: Question about PROTO format in DLL
Post by: Rainstorm on September 17, 2006, 08:36:46 PM
I just opened the masm32rt.inc
& it doesn't seem so..it just includes all the files etc like in the  normal structure

(correct me though if i am wrong)

-

Title: Re: Question about PROTO format in DLL
Post by: Rainstorm on September 17, 2006, 08:40:01 PM
guess we posted togethr..

was having a prob assembling something  & it assembled & ran fine when i replaced the usual structure with masm32rt.inc. was probably a file i hadn't included

thanks for the prompt reply..



Title: Re: Question about PROTO format in DLL
Post by: PBrennick on September 17, 2006, 09:08:03 PM
Glad to help.  :U

Paul