main() method stub

The main() method calls pub_initialize(), publish_<msgname>_Message() which publishes the message, and pub_shutdown().

This example shows the main() method in the stub generated from the Bond Quote sample message definition.

int main( int argc, char ** argv ) 
{
    PUB_STARTUP startup_settings;
    uint16_t    errorCode;

    // Set the startup_settings
    errorCode = pub_initialize( &startup_settings );
    if( errorCode != ERR_NONE ) {
        // Add error handling code.
    }

    errorCode = publish_Bond_Quote_Message();
    if( errorCode != ERR_NONE ) {
        // Add error handling code.
    }

    errorCode = pub_shutdown( true );
    if( errorCode != ERR_NONE ) {
        // Add error handling code.	
    }
    
    return 0;
}
Related tasks
Developing the main() Method in a Stub
Related reference
pub_initialize
pub_shutdown