|
Boost Users : |
Subject: [Boost-users] Boost.Function __stdcall, __fastcall, etc
From: Brian Rowlett (brianjrowlett_at_[hidden])
Date: 2010-04-25 22:50:21
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net