how can i get error from __attribute__((weak))?
i can't test, now,
1 2 3 4 5 6 7
|
#if defined __GNUC__
#define EVENT [[gnu::weak]]
#elif defined __clang__
#define EVENT [[llvm::weak]]
#elif defined _MSC_VER
#define EVENT __attribute__ ((weak))
#endif
| |
because, on VS, i get a problem with pointers:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
template <typename CBase>
class test
{
CBase* atPointer = nullptr;
public:
test(CBase *clsPointer) : atPointer(clsPointer)
{
//if (IS_EVENT_DEFINED(&CBase::MouseClick))
atPointer->MouseClick();
//if (IS_EVENT_DEFINED(&CBase::Move))
atPointer->Move();
}
void call()
{
//if (IS_EVENT_DEFINED(&CBase::MouseClick))
atPointer->MouseClick();
//if (IS_EVENT_DEFINED(&CBase::Move))
atPointer->Move();
}
};
class InstanceName : public test<InstanceName>
{
public:
InstanceName() : test(this) { ; }
~InstanceName() { ; }
public:
void MouseClick();
void Move();
};
void InstanceName::MouseClick()
{
std::cout << "Mouse click\n";
}
void InstanceName::Move()
{
std::cout << "Move\n";
}
| |
why i don't get the pointer correctly?
(the functions 'MouseClick()' aren't called)
Topic archived. No new replies allowed.