News:

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

Dont want to use MASM macro

Started by alpha1, January 23, 2005, 05:38:52 PM

Previous topic - Next topic

alpha1

sorry not
.model 386p, stdcall   but
.model FLAT, stdcall
:red

alpha

alpha1

Yes, I was wrong. .model FLAT, stdcall was the key for all this madness :) But I still prefer not using stdcall key in /model definition. It is becouse I can use different calling convention functions in the same library.
Thanks again.

alpha

hutch--

You can do that anyway by making individual prototypes with differenct calling conventiona. Almost all API calls are STDCALL by wsprintfA is C.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Vortex

Hi alpha1,

QuoteI can use different calling convention functions in the same library

What are the conventions you are using?

thomasantony

Hi alpha1,
        proc is a MASM keyword that make a stack frame using push ebp, mov ebp,esp etc. If you do not want to use it, declare your proc as a label like Vorte did and implement all the stack stuff yourself!!

Thomas Antony
There are 10 types of people in the world. Those who understand binary and those who don't.


Programmer's Directory. Submit for free

alpha1

Quote from: Vortex on January 25, 2005, 10:39:29 AM
What are the conventions you are using?

Mostly stdcall and cdecl.

alpha

Vortex

Hi alpha1,

Why don't you prefer using PROC & ENDP statements to code your procedures?

James Ladd

Alpha1,

A label in assembler is a meaningful name the compiler uses to "mark" an offset in the code.

A function like "myFunction:" just marks an entry point to some instructions and makes it easy for us to read the code.

When you dont use the macros for defining the function you need to ensure that the instructions following the
label contain the right prologue and cleanup for a function. ie: pushing arguments onto the stack and balancing them
afterward. If you use the macro this is done for you.

When you export a function using the export keyword or a definition file you are just making the label externally available.
When you jmp to a label execution moves from the current place in the code to the label.

Different calling conventions will influence how the stack is treated when the ret instruction is encountered.
You can do away with any calling convention macro, but you will still need to do these things manually.
If you want 'c' calling convention then you will have to push the parameters onto the stack in the right 'c' order and
balance the stack yourself. If you use a different calling convention then different rules apply.

Some of this is more clear in the documentation for goASM as it has less macros and there is a great section in the
help about labels and using them. Even making nested procs with labels etc. This may help you.

I admire your desire to fund a low level way to implement functions. Like the way you would do it is macros didnt exist
at all. That one of the reasons I used and like goASM. However, the same is achievable in MASM.

I hope this helps.