I want to define C styile function with macro.
sample:
FunctionName (param1,param2)
how to filter bracket ( )?
FunctionName macro p1,p2
push p2
push p1
call myfunct
endm
Just omit the brackets
FunctionName macro p1,p2
push p2
push p1
call myfunct
endm
.code
...
FunctionName eax,OFFSET blah
...
This is the simplest form - there are many, many different ways (angle brackets, returning a value, ...)
ok.
But I want to use bracket macro calling.
FunctionName (par1,par2)
I want C style code
CreateWindow(p1,p2,p3,p4)
FunctionName macro p1,p2
push p2
push p1
call myfunct
exitm <>
endm
Quote from: korte on March 05, 2007, 11:05:14 AM
I want C style code
So use C :bg
MASM won't let you use brackets without some fancy stuff...
And really, what's so good about brackets? just more typing
I want to create portable code. ASM betwen C.
Define all procedure to macro.
Perfectly work but missing ugly bracket.
gfalen
exitm <> ???
Quote from: korte on March 05, 2007, 11:46:01 AM
I want to create portable code. ASM betwen C.
I can see C being portable (with a lot of conditionals) but ASM (at least MASM/ML) is processor-specific - the Intel x86 instruction set.
AFAIK macros only work with MASM (
Macro
ASse
Mbler) but I could be wrong - I can (sort of) figure out C/C++ code but
couldn't write a "Hello World" program in C to save my mother...
Maybe you want to create .obj files in MASM to link with C?
Greetings,
Unless I am mistaken, what korte wants to do is to allow his .asm modules to conditionally call C-style functions that are defined elsewhere (a la VS 2005 perhaps?) by the means of macro definition. Maybe something like the following?
ifdef _DEBUG
DoSomethingCool MACRO p1, p2
push p2
push p1
call MyCoolFunc_d ;debug version of function
endm
else
DoSomethingCool MACRO p1, p2
push p2
push p1
call MyCoolFunc ;release version
endm
endif
This is just an example. Hope it helps.
Tim