This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

spawn a method as a task (C++)

Hello,

I'm using RTX and I'm porting my C code tot C++. Now I have a problem with os_tsk_create_user. I want to use a class method as the function for os_tsk_create_user :


Example::Example(void)
{

mExampleTask = os_tsk_create_user (exampleTask, PRIORITY, mTaskStack, sizeof(mTaskStack));
}

__task void Example:: exampleTask(void)
{ ...
}

error: #167: argument of type "void (Example::*)()" is incompatible with parameter of type "void (*)() C"

Casting the method:


mExampleTask = os_tsk_create_user ((void(*)())exampleTask, PRIORITY, mTaskStack, sizeof(mTaskStack));

error: #171: invalid type conversion

The only way to get it working is when I make my method static. But I'm using class variables in my task, so this is not what I want...

How do I get this working?

Regards,

Roland Beuker

0