开发者

To Inline an External Function Written in Assembly

开发者 https://www.devze.com 2023-03-10 09:27 出处:网络
I have a separate function written in assembly and want to call it in my C/C++ code.Is it possible to tell my compiler (MS Visual C++ 2010) to inline that module written in assembly into my C/C++ func

I have a separate function written in assembly and want to call it in my C/C++ code. Is it possible to tell my compiler (MS Visual C++ 2010) to inline that module written in assembly into my C/C++ function?

Note, I am not tal开发者_如何学Pythonking about using inline assembly code (__asm {}) in my C/C++ function. All assembly codes are written in separate independent modules.


Is it possible to tell my compiler … to inline that module written in assembly into my C/C++ function?

No. The compiler doesn’t even see the assembly code – it’s in a different compilation unit. You can ask your linker to inline the function though. In order to do that, you need to enable link-time optimizations.

There may be a separate option for the linker that tells it to perform inlining but usually this should be done automatically where it makes sense.

0

精彩评论

暂无评论...
验证码 换一张
取 消