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.
精彩评论