What’s the CORRECT way to send a Queue message from another module?

Instead of asking what’s WRONG with my code, can someone please point me to an example, or provide an example, of the correct way to use xQueueSend from a module other than where the queue handle and function handler are defined? I’m using FreeeRTOS 8.2.0, in IAR EWARM 7.3, on an STM32F4 controller. I am unable to find an example on the entire web that shows this, and it just happens to be giving me a big headache right now. Thank you…

What’s the CORRECT way to send a Queue message from another module?

It shouldn’t make any difference which module the queue handle is defined in. A queue handle is just a variable, so it can be declared in one C file, and then extern’ed in another C file, just like any other variable. File1.c

/* Declared globally. */
QueueHandle_t xQueue = NULL;

int main( void )
{
   . . .

   xQueue = xQueueCreate( 5, sizeof( uint32_t ) );

   . . .

   /* Start tasks. */

   . . .


   /* Start scheduler. */
}

void vTask1InFile1( void *pvParameters )
{
uint32_t DataToSend = 0, DataToReceive;
const TickType_t xBlockTime = pdMS_TO_TICKS( 200 );

    for( ;; )
    {
        . . .

        xQueueSend( xQueue, &DataToSend, xBlockTime );

        . . .

        xQueueReceive( xQueue, &DataToReceive, xBlockTime );
    }
}
File2.c

void vTask2InFile2( void *pvParameters )
{
/* Here the queue handle is extern. */
extern QueueHandle_t xQueue;

uint32_t DataToSend = 0, DataToReceive;
const TickType_t xBlockTime = pdMS_TO_TICKS( 200 );

    for( ;; )
    {
        . . .

        xQueueSend( xQueue, &DataToSend, xBlockTime );

        . . .

        xQueueReceive( xQueue, &DataToReceive, xBlockTime );
    }
}
Regards.