That's called an inline
function. If you're linking against that module, you can move the implementation to a cpp
file, so it's not visible outside. That way, any modules trying to use it will have to call it.
You can also disable set the compiler flag "inline function expansion" to Only __inline (/Ob1)
to prevent inlining
in the current module, assuming you're not marking it as inline
.
Or use:
#pragma auto_inline(off)
void foo()
{
}
#pragma auto_inline()
EDIT:
I listed my first variant first as that's the proper way to do it. You should let the optimizer do what it can to speed up your code. It shouldn't matter to you if it's inlined in your own module (or others, for that matter, since the assembled code is still visible in your binary), but if you really must do it, choose the first option.