简体   繁体   English

我可以使用带有ac-字符串变量而不是字符串文字作为参数的asm函数吗?

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

I did something like this : 我做了这样的事情:

char command [] = "Some assmebly code"; char命令[] =“一些组装代码”;

asm volatile(command); asm volatile(命令);

It didnt work. 它没有用。 Specifically, I get the following error : Expected string literal before command. 具体来说,我得到以下错误: Expected string literal before command.

So, can I only use string literals with C inline assembly ? 因此,我只能在C内联汇编中使用字符串文字吗? I really want to be able to use string variables like above. 我真的很希望能够使用上面的字符串变量。 How can I achieve this effect ? 我怎样才能达到这个效果?

As far as I know asm code fragment are inlined during compilation phase, not run-time. 据我所知,asm代码段是在编译阶段而不是运行时内联的。 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. 正如pmg建议的那样,您可以通过调用外部命令来做到这一点,但这意味着用户将需要安装所有工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM