mix c++ and assembly

in masm i can do this

1
2
3
4
5
push 0
push offset title
push offset msg
push 0
call MessageBoxA


in mixing c++ and assembly i cant

1
2
3
4
5
6
7
8
9
10
11
12
13
char msg[] = "Hello World";
	char title[] = "info";

	__asm
	{
		push 0
		push offset title // error
		push offset msg //error
		push 0
		call MessageBoxA
		ret
	}
	return 0;

error C2415: improper operand type
 error C2415: improper operand type

...need help with this..thanks in advance
Is what you are trying to do even possible? Seems like it shouldn't work
can i call api with mix asm ?
There is different dialects of assemby language. By default Gcc uses AT&T for example. Mayby your compiler isnt supporn this? Try:
1
2
3
4
5
6
7
    push 0
    mov  eax, offset title
    push eax
    mov  eax, offset msg
    push eax
    push 0
    call MessageBoxA
i still have the same error on that example (im using VC++ 2008)...thanks anyways guys
Read about which assembly dialect does your compiler support.
Topic archived. No new replies allowed.