News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

mangled names linking modules

Started by markallyn, September 12, 2017, 02:17:56 AM

Previous topic - Next topic

markallyn

Good afternoon, aw27,

Thanks for the taskmanager tip!  Very very helpful.

I've learned a great deal from you and Vortex over the last couple of days.  First there was the business about PROTO/EXTERN.  I think that part is cleared up with the exception of the difference in syntax for file names that seem to be true of the two declarations.  The other matter you were perhaps less aware of, but without knowing it you clarified what PROC does and which had completely passed me by.  Namely, if the arguments are added after the PROC keyword there is no requirement to set up the stack--PROC does it for you.  In fact, as I learned, if you DO set up a stack, it really messes up the PROC and it won't run correctly because it attempts to push ebp a second time.

The only documentation I have is an old book of V. 6.1 masm.  The book makes it sound like you can use the invoke command either with the PROTO definition OR with EXTERN.  But, when I tried that the program failed.  Did MASM later versions change the rule?

Thanks again for staying with me.

Mark

hutch--

Mark,

If you are going to use any recent (in the last 20 years) version of 32 bit MASM, use a PROTOTYPE for a procedure/function if you are going to use the "invoke" notation.

YourFunction PROTO STDCALL :DWORD,:DWORD etc .....


You can make the procedure call manually,

push arg2
push arg1
call function
mov retval, eax


To do this you need to include the system library that contains the function.

aw27

Quote
if you DO set up a stack, it really messes up the PROC and it won't run correctly because it attempts to push ebp a second time
If you want to roll your own you will be better off making the procedure naked.
OPTION PROLOGUE:NONE
OPTION EPILOGUE:NONE