ARMmbed / mbed-events

DEPRECATED! This project has moved to mbed-os
https://github.com/ARMmbed/mbed-os/tree/master/events
Apache License 2.0
11 stars 6 forks source link

master does not work with mbed OS 5.1.* when calling member function #25

Closed janjongboom closed 7 years ago

janjongboom commented 7 years ago
[Error] EventQueue.h@766,0:  #135: namespace "mbed" has no member "callback"

When doing

queue.call_every(1000, bla, &Bla::hoi);

Workaround:

Callback<void()> hee(bla, &Bla::hoi);
queue.call_every(1000, hee);
geky commented 7 years ago

Thanks for reporitng this, it's a bit entertaining that this combination of versions compiles at all.

I believe the mbed::callback function was introduced in mbed OS 5.1.5. Is this issue only present <=5.1.4?

Unfortunately, we don't have the best system for versioning, but you should be able to use v0.6 of mbed-events with previous versions of mbed OS. Let me know if this doesn't work for you.

janjongboom commented 7 years ago

This was against 5.1.5... It's a PITA that we have all these versions. When someone adds this repo to their project in online IDE they have to manually switch versions, not nice.

I'll try with v0.6 tag. I tried it yesterday but it had issues too, will report them.

Side note: It's the macros which save you here, as the macros are compiled away when not used, so that's how we can still do the workaround ;-) Normal functions would just have killed the compilation regardless of whether you used mbed::callback or not.

geky commented 7 years ago

Agreed, it looks like we may get support for a "latest" branch soon in the online compiler to aleviate this problem, although there is still some effort needed.


It looks like I was wrong on the version introducing the mbed::callback function. Looks like it wasn't added until mbed OS 5.2: https://github.com/ARMmbed/mbed-os/pull/2496

Since the mbed-event library was merged into mbed OS in mbed OS 5.2, I don't see a good reason for this repo to exist outside of support for old versions.

I went ahead and put up a pr that works around without the callback function. Let me know if there is still an issue: https://github.com/ARMmbed/mbed-events/pull/26

geky commented 7 years ago

Feel free to reopen if this issue is still present