Call assembly in c++ under linux# Programming - 葵花宝典
G*m
1 楼
I'm writing some code which needs to call assembly function in C++ code.
it works fine under windows, however, it does not work under linux, i googled
lot, could not figure out the problem, can anybody help me out of this.
Here is the code.
// header file a.h
#define __ASM_NAME(name) "_" name
#define __ASM_TYPE(name) ".type " __ASM_NAME(#name) ",@function\n"
#define __ASM_GLOBAL_FUNC(name,code) \
__asm__( ".align 4\n\t" \
".globl " __ASM_NAME(#name) "\n\t" \
it works fine under windows, however, it does not work under linux, i googled
lot, could not figure out the problem, can anybody help me out of this.
Here is the code.
// header file a.h
#define __ASM_NAME(name) "_" name
#define __ASM_TYPE(name) ".type " __ASM_NAME(#name) ",@function\n"
#define __ASM_GLOBAL_FUNC(name,code) \
__asm__( ".align 4\n\t" \
".globl " __ASM_NAME(#name) "\n\t" \