Saturday, April 21st 2018, 11:20pm UTC+2

You are not logged in.

  • Login
  • Register

lawberman

Beginner

Date of registration: Jan 6th 2008

Posts: 15

1

Monday, February 4th 2008, 3:24pm

passing a pointer to a stack variable to a mailbox

Hi

Would there a be problem calling OS_PutMail for a multi byte message, passing it a pointer to a temporary stack variable, for example:

void aFunction(void)
{
short int aMsg = 12345678;

OS_PutMail(&aMB, &aMsg);
}

Thanks
Lawrence

Date of registration: Dec 20th 2007

Posts: 26

2

Wednesday, February 6th 2008, 2:34pm

Hi,

No problem, you may use local variables to pass data via mailbox.
The mailbox stores the data and not the pointer to the data.
When calling OS_PutMail(), the data which is pointed to by the data pointer is copied into the mailbox buffer, before the OS_PutMail() function is left.

Regards,
Armin

Similar threads