Can I use asm function with a c - string variable instead of a string literal as an argument?

人盡茶涼 提交于 2019-12-24 06:58:09

问题


I did something like this :

char command [] = "Some assmebly code";

asm volatile(command);

It didnt work. Specifically, I get the following error : Expected string literal before command.

So, can I only use string literals with C inline assembly ? I really want to be able to use string variables like above. How can I achieve this effect ?


回答1:


As far as I know asm code fragment are inlined during compilation phase, not run-time. Which means you can't do what you are doing.

As pmg suggested, you could do it by calling external commands, but it would mean user would need to have all the tools installed.



来源:https://stackoverflow.com/questions/7581799/can-i-use-asm-function-with-a-c-string-variable-instead-of-a-string-literal-as

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!