Making permanent changes to the main file

Procedure

  1. In the browser, right-click the component whose main file you want to edit.
  2. Select Add New > File to create a file.
  3. Name the new file (for example, myMain).
  4. Open the Features window for myMain and set the File Type field to Logical or Implementation.
  5. Select the Properties tab.
  6. Click OK.
  7. Right-click the active configuration for the component (used to build the application) and then select Edit Configuration Main File.
  8. Copy the contents of this file, including the header files.
  9. Open the Features window for myMain and click Add Text.
  10. Paste the code from the generated main file into the Text Element field.
  11. Customize the code as wanted.
  12. Click OK.
  13. Set the following properties for the configuration:
    1. Set CG::Configuration::MainGenerationScheme to UserInitializationOnly. This property controls how the main is generated.
    2. Set <lang>_CG::<Environment>::EntryPoint to myMain. This property specifies the name of the main program.

Results

Now when you compile the application, the product compiles your customized main instead of generating a new one.