| |||
| Home > Inline and Embedded Assemblers > Embedded assembler > Keywords for member function classes | |||
The following keywords facilitate the calling of virtual and
non-virtual member functions from an __asm function.
The keywords beginning with __mcall can be used
for both virtual and non-virtual functions. The keywords beginning
with __vcall can be used only with virtual functions.
The keywords do not particularly help in calling static member functions.
__mcall_is_virtual(D,
f)Results in {TRUE} if f is
a virtual member function found in D, or a base class
of D, otherwise {FALSE}. If
it returns {TRUE} the call can be done using
virtual dispatch, otherwise the call must be done directly.
__mcall_is_in_vbase(D,
f)Results in {TRUE} if f is
non-static member function found in a virtual base class of D,
otherwise {FALSE}. If it returns {TRUE} the this adjustment must
be done using __mcall_offsetof_vbaseptr(D, f),
otherwise it must be done with __mcall_this_offset(D, f).
__mcall_this_offset(D,
f)Where D class
type and f is a non-static member function defined
in D or a non-virtual base class of D.
This returns the offset from the beginning of a D object
to the start of the base in which f is defined.
This is the this adjustment necessary when making
a call to f with a pointer to a D.
It is either zero if f is found in D or
the same as __offsetof_base(D, B), where B a
non-virtual base class of D that contains f.
If __mcall_this_offset(D, f) is used when f is
found in a virtual base class of D it returns
an arbitrary value designed to cause an assembly error if used.
This is so that such invalid uses of __mcall_this_offset can
occur in sections of assembly code that will be skipped. See the
general example below.
__vcall_offsetof_vfunc(D,
f)Where D is
a class and f is a virtual function defined in D,
or a base class of D.
This returns an offset into the virtual function table at which the offset from the virtual function table to the virtual function can be found.
If __vcall_offsetof_vfunc(D, f) is used
when f is not a virtual member function it returns
an arbitrary value designed to cause an assembly error if used.