Re: IsBadCodePtr( (FARPROC)pointer_to_member_function)

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Victor Bazarov (v.Abazarov_at_comAcast.net)
Date: 02/15/05


Date: Mon, 14 Feb 2005 21:26:14 -0500


"Bill Davy" <Bill@SynectixLtd.com> wrote...
> Does not compile in VC6:
>
> error C2440: 'type cast' : cannot convert from 'HWErrors::HWErrorT
> (__thiscall SpinnerC::*const )(void)' to 'int (__stdcall *)(void)'
> There is no context in which this conversion is possible
>
> Is there a way round this?

Nope.

A non-static member function needs an instance of the class to be
called, that's why the conversion between a pointer to non-static
member and a pointer to a function does not exist.

> I'd just like, for completeness, to ensure that a call through a
> (non-virtual) member function pointer is not going to explode immediately.

Why? Do you manually load code into some arbitrary memory location?



Relevant Pages