This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Inline Assembly from an assembly file into a C++ function

Hi,

I need to :

1. Inline an assembly code that modifies Stack pointer directly (__asm directive is not allowed to modify stack pointer) in a C++ file.

What is the best option? A function call to a label is not an option since I need to manually update Stack Pointer. I need to inline.

I read I can create SRC file. Can I create SRC from the C++ compiler ? if so what is the Directive/Flag? --SRC didn't work.

#prama asm was unrecognized pragma. perhaps because I'm not creating SRC.

Thanks.

Parents
  • Why exactly do you need to be muddling with the stack pointer, and why can't that be in an assembler routine so as not to interfere with the compiler's ability to efficiently understand and optimize for the CPU state as it understands it?

    Putting this type of inline assembler makes for highly non-portable code, which is also very fragile.

Reply
  • Why exactly do you need to be muddling with the stack pointer, and why can't that be in an assembler routine so as not to interfere with the compiler's ability to efficiently understand and optimize for the CPU state as it understands it?

    Putting this type of inline assembler makes for highly non-portable code, which is also very fragile.

Children