J
James Clark
We've been using VC6 for some time and are trying to port some specific
code to VC7.1 (VC++ .Net 2003). But I've come across problems where
__forceinline doesn't inline simple inline assembly that we need to be
inlined. VC6 has no such problems.
A simple, stripped-down, example is as follows:
__forceinline void func()
{
__asm
{
push offset _end
ret
_end:
}
}
It seems to be the "push offset _end" that's causing the problem. When
this is included, I get the following "warning C4714: function 'void
func ()' marked as __forceinline not inlined".
I've seen this in VC6 where certain mnemonics prevent inlining, and
changing these to use _emit fixes this, but I don't think _emit can be
used in the above example since the compiler needs to know the address
of "_end".
I've tried various compiler switches but nothing seems to be helping. My
only current solution is to build .libs in VC6 for the critical code and
use VC7 for the rest, but this isn't really a long-term solution.
Maybe there's a hidden option or #pragma somewhere to improve the
functionality of __forceinline?
Any ideas?
code to VC7.1 (VC++ .Net 2003). But I've come across problems where
__forceinline doesn't inline simple inline assembly that we need to be
inlined. VC6 has no such problems.
A simple, stripped-down, example is as follows:
__forceinline void func()
{
__asm
{
push offset _end
ret
_end:
}
}
It seems to be the "push offset _end" that's causing the problem. When
this is included, I get the following "warning C4714: function 'void
func ()' marked as __forceinline not inlined".
I've seen this in VC6 where certain mnemonics prevent inlining, and
changing these to use _emit fixes this, but I don't think _emit can be
used in the above example since the compiler needs to know the address
of "_end".
I've tried various compiler switches but nothing seems to be helping. My
only current solution is to build .libs in VC6 for the critical code and
use VC7 for the rest, but this isn't really a long-term solution.
Maybe there's a hidden option or #pragma somewhere to improve the
functionality of __forceinline?
Any ideas?