views:

191

answers:

1

I know you can simply do

char msg[] = "lol"; _asm { push msg }

But is there a way to do it in the assembly part?

_asm { push "lol" } This comes up with a compiler error

I'm a beginner, be nice :P

A: 
call @F
db 'lol',0
@@:

That's how you'd do it in MASM, not sure of the exact syntax for inline assembly. But there is one big difference. The first method stores the "lol" string in the data section of the exe, whereas the inline version stores it in the code section. For a few strings it's not that big a deal.

Paul Alexander
Is there a way to do this in visual c++? "error C2400: inline assembler syntax error in 'opcode'; found 'constant'"
Dnaiel
You can't use MASM directives in inline assembler. See http://msdn.microsoft.com/en-us/library/h70hd396(VS.71).aspx
zebrabox