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 <typename _Signature, enum LibraryId _LibraryId, int _Offset>
class FunctionPointer: protected OffsetPointer, public boost::function<_Signature>
{
public:
    FunctionPointer(void)
    : boost::function<_Signature>( OffsetPointer::_getOffset(_LibraryId, _Offset )
    { return; }
};
 
I instantiate this with:
 
FunctionPointer<return_type__stdcall( argument_types ), LibraryId, Offset> Function;
FunctionPointer<return_type __cdecl( argument_types ), LibraryId, Offset> 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?

--
+ Brian J. Rowlett