Developing a traditional Synergy application

This topic includes the following sections:

 

Synergy DBL Integration for Visual Studio (SDI) includes support for traditional Synergy development. This means you can use Visual Studio to develop traditional Synergy libraries and executables for Windows, Linux, and OpenVMS desktop and server systems.

In Visual Studio, builds take the place of the compiling and linking required when developing outside of Visual Studio. When you build a traditional Synergy project in Visual Studio, the Synergy compiler is used automatically behind the scenes, and when you build a Visual Studio solution with traditional Synergy projects, the Synergy compiler and linker are used behind the scenes.

Note the following:

Development steps for traditional Synergy

The following steps outline the process for creating projects for a traditional Synergy application. Most of the following steps are for Visual Studio procedures, so see Visual Studio documentation for more information.

1. Set options for your Visual Studio environment. For example, you can control the behavior of the Visual Studio code editor (indentation, tab size, etc.) and the way IntelliSense works for Synergy DBL files. See Options for Synergy/DE projects for more information.
2. Create a solution, and create projects for the mainline program and libraries for your application. Use the following Synergy project templates in Visual Studio to create a project for each program and library in your application, and optionally create a project for each repository used by your application. Use these templates for Windows, Linux, and OpenVMS development (e.g., use the Executable Library template for code that will become a shared library on OpenVMS). See Synergy/DE project templates for more information.

For example, to create a traditional Synergy program with a single .dbr file, select File > New Project. Then select Synergy/DE from the Installed Templates area of the New Project dialog, and select “Traditional Application (DBR)” from the list of project types. You’ll then need to set a few options for the project (name, location, and so forth) in the New Project dialog.

See Synergy projects, solutions, and files for more information, and note the following:

3. Build out and configure your projects by adding code and other items, referencing other projects and files as necessary, setting environment variables, setting project properties, and setting up build configurations.

Add code and other items to your project

You can add a new or existing item, such as a code file, by right-clicking the project node in Solution Explorer and selecting one of the following from the context menu: Add > New Item, Add > Existing Item, Add > Reference Existing Item. (The Add > Existing Item command copies the file into the Visual Studio project. Add > Reference Existing Item adds a relative-path reference to the item.) Note the following:

Reference projects and files as necessary

References enable a project to use other libraries, repositories, and external files. (Referencing a library is equivalent to linking to a library — i.e., adding a library to a dblink command — when developing outside of Visual Studio.) You can add a reference by right-clicking the Reference node in Solution Explorer and selecting Add Reference from the context menu. Note the following:

Set environment variables

Set environment variables needed for developing and running the application. See Environment variables and Visual Studio development for information on where you can set environment variables, when they are used, and precedence for different locations.

Set project properties, and set up build configurations

Use Project Designer to configure project properties, and set up sets of build and debug settings so that your projects and solution can be built and debugged in different ways. See Common project settings below for information on commonly used project properties, or see Synergy/DE project properties for details on these settings. Note the following:

4. Build the solution or an individual project by using a build or rebuild command in Visual Studio. For example, you can rebuild the entire solution by selecting Build > Rebuild Solution from the Visual Studio menu. Note the following:

The Visual Studio Error List (View > Error) will list any errors encountered in the build. If the Error List in Visual Studio displays a lot of errors, keep in mind that you can filter this list so that it is limited to the current project (this can be very helpful), the current document in the editor, or all documents open in the editor. You can also use the search feature for the Error List to find specific words or phrases in the list, and you can filter out errors, warnings, or messages. To clear only Synergy-related errors and warnings from the Error List, select Tools > Clear Error List from the Visual Studio menu.

5. Debug the project or solution. To debug a project or solution, it must be built in Debug mode. See Debugging traditional Synergy with Visual Studio for more information.

Common project settings

Visual Studio’s Project Designer enables you to set project-level settings (i.e., project properties), and it enables you to set environment variables. The following are some of the most commonly used features in Project Designer. See Synergy/DE project properties for more information, including information on other pages and settings that are available for Synergy projects.

Application page

The Application page enables you to configure various application-level settings for a project.

Note that if your code files have .INCLUDE statements that don’t specify a path (e.g., .INCLUDE myfile.def), you’ll need to set the "Working directory" option to the directory with the included files (e.g., the directory with myfile.def).

See Application page, Project Designer (traditional Synergy) for more information.

Build page

The Build page enables you to configure build settings for a configuration/platform combination for the project.

Although you can use Visual Studio to build files for Linux, you can’t run Linux applications on Windows because of path differences. So for Linux, set the output path for the project to a network share on a Linux machine. This will enable you to build the project in Visual Studio and then run and debug the program on the Linux machine.

See Build page, Project Designer for more information on Build page settings.

Compile page

The Compile page enables you to set compiler options for a project. See Compile page, Project Designer (traditional Synergy) for more information.

Debug page

The Debug page enables you to set debugging behavior for a profile (for a .NET Core or .NET Standard project) or a configuration/platform combination (for all other project types). See Debug page, Project Designer for more information on Debug page settings. See Configurations, platforms, and profiles for more information on configuration/platform and profile settings.

Environment Variables page

The Environment Variables page enables you to set project-specific environment variables that are used at build time. Locations specified by environment variables set here are also used to populate the Synergy tab of the Reference Manager for Visual Studio. See Environment Variables page, Project Designer.

Common Properties page

The Common Properties page enables you to set environment variables that are used at build time and that can be applied to any project in the solution. Locations specified by environment variables set here are also used to populate the Synergy tab of the Reference Manager for Visual Studio. See Common Properties page, Project Designer.