mix c++ and assembly

Jan 27, 2013 at 8:07am
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
Jan 27, 2013 at 8:42am
Is what you are trying to do even possible? Seems like it shouldn't work
Jan 27, 2013 at 8:54am
can i call api with mix asm ?
Jan 27, 2013 at 9:26am
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
Jan 27, 2013 at 9:50am
i still have the same error on that example (im using VC++ 2008)...thanks anyways guys
Jan 27, 2013 at 10:13am
Read about which assembly dialect does your compiler support.
Topic archived. No new replies allowed.