JC> To act as an interrupt handler, your member function must be static.
Some C++ compilers don't allow the calling convention of a function member
(even a static one) to be modified, so this isn't universally true.
I encountered this problem when trying to use a static function member as a
callback to pass to a system API call in IBM VisualAge C++. The callback had
to have the "System" calling convention, but static function members had the
"C++"/"Optlink" calling convention and VAC++ (quite legally) disallowed the
use of a calling convention modifier on a function member.
In the general case therefore (if one is talking about *all* C++ compilers),
callback functions, whether for use as interrupt handlers or for passing to
system APIs, still have to be ordinary functions, not class members.
¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
|