AMDG Brian Rowlett wrote:
I am writing a DLL that gets injected into another process, and creates pointers to the target processes functions. The target process uses all 3 calling conventions, __stdcall, __fastcall and __cdecl.
I have created a class whos constructor gets the address of the function, and passes it to the base class boost::function:
template
class FunctionPointer: protected OffsetPointer, public boost::function<_Signature> { public: FunctionPointer(void) : boost::function<_Signature>( OffsetPointer::_getOffset(_LibraryId, _Offset ) { return; } }; I instantiate this with:
FunctionPointer
Function; FunctionPointer
Function; Whatever calling convention Visual Studio is setup to use (__cdecl by default), works just fine. But trying to instantiate it with another calling convention gives the following error:
Error 1 error C2504: 'boost::function<Signature>' : base class undefined
It seems weird that it would work for some calling conventions, and not others..
Any ideas?
Don't try to specify a calling convention for Boost.Function. return_type __cdecl(argument_types) works because it is equivalent to return_type(argument_types) which is what Boost.Function accepts. A boost::function should be able to store function pointers that use /any/ calling convention. In Christ, Steven Watanabe