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. Note the following:

Development steps for traditional Synergy

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

1. Start by setting options for your Visual Studio environment. For example, you can control the behavior of the Visual Studio code editor (indentation, tab size, etc.), the way IntelliSense works for Synergy DBL files, and which file types are automatically treated as compile or content files. See Options for Synergy/DE projects for more information.
2. Create a solution for your application, and create projects for the mainline program, libraries, and (optionally) repositories for the application. To create these projects, use the following project templates:

For example, to create a program with a single .dbr file, select File > New Project in Visual Studio. Then select the "Traditional Application (DBR)" template. (You can use the New Project dialog's search field to find this.) See Synergy projects, solutions, and files for more information, and note the following:

  • If no solution is open in the current instance of Visual Studio, creating a project will also create a solution to contain the project. To add the project to an existing solution, open the solution in Visual Studio before you create the project. To start with a blank solution, do the following before you create projects for the application: select File > New > Project from the Visual Studio menu, and then select the Blank Solution template. You can use the search feature in the New Project dialog to find this template.
  • When creating a library for shared code, use an ELB rather than an OLB. (An OLB project should be referenced by only one project in the solution. Referencing an OLB project from multiple projects causes the OLB code to be compiled into multiple files for the application.)
  • You can create an ELB that builds directly from an OLB. See Executable Library (ELB).
  • If your application uses files generated by gennet40, create a separate ELB or OLB project for these files, and in step 2 below add the source files and the .inc file generated by gennet40 to this project. (Add the source files as compile files, and add the .inc file as a content file.) Then in step 3 below, add a reference to this project in the mainline (DBR) project, and set the "Concat source files (-qconcat)" option on the Compile page of project properties.
  • For Linux and OpenVMS development, use the project templates listed above. See Linux development and OpenVMS development.
3. Build out and configure your projects by setting project properties, adding code and other items, referencing other projects and files as necessary, setting environment variables, and setting up build configurations. For more information, see

Note the following:

  • For Multiple Mainline projects, the "Startup object" field on the Application page of project properties determines which mainline is used as the starting point when you select a Visual Studio debug or run option. You can also set this by right-clicking a source file in Visual Studio's Solution Explorer and selecting "Set as Startup Object" from the context menu.
  • The "Target Synergy runtime" setting on the Build page of project properties specifies the version of the Synergy runtime that the executable or library will target, enabling you to build an assembly for systems with earlier versions of the Synergy runtime.
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:
  • Make sure the configuration and platform settings on the Visual Studio toolbar are correct for the build. See Configurations, platforms, and profiles for more information.
  • To build or rebuild (or clean) a project without affecting other projects in the solution (even referenced projects), use a Project Only menu entry — e.g., Build > Project Only > Rebuild Only Project. See SDI features for information.
  • You can control the link order for referenced items for a traditional Synergy program by setting priority levels for these items. See Setting link priority for traditional Synergy in Visual Studio.

The Visual Studio Error List (View > Error) lists any errors encountered in the build. You can filter this list so that it is limited to the current project (which 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, and note the following:
  • Make sure configuration, platform, and profile settings are correct for the debugging session. The active configuration/platform combination determines which debug settings are used and which build is debugged. See Configurations, platforms, and profiles.
  • For information on debugging applications for Linux and OpenVMS, see Linux development and OpenVMS development below.

Adding code and other items

You can add a new or existing item (a code file, a text file, etc.) by right-clicking the project node in Visual Studio's Solution Explorer and selecting one of the following from the context menu: Add > New Item, Add > Existing Item, or 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:

Referencing projects and files

References enable a project to use other projects (libraries and 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 Visual Studio's Solution Explorer and selecting Add Reference from the context menu. Note the following:

Linux development

For Linux, there are two Visual Studio development paths:

In either case, use the same project templates you would use for Windows (see step 2 above). And be sure to use the linux32 or linux64 platform target (see Adding a Linux or OpenVMS platform for traditional Synergy). These platform targets cause Visual Studio to compile the projects as if they were compiled on a Linux system — e.g., code marked with OS_UNIX is included.

Keep in mind that Linux is case sensitive, so when you define environment variables or specify paths or filenames, make sure the case is correct.

To debug a Linux application, you'll need to run the application on a Linux machine and then use remote debugging to debug the application from Visual Studio, or use standard traditional Synergy debugging on the Linux machine. See Debugging traditional Synergy with Visual Studio for more information.

OpenVMS development

For OpenVMS, you can develop and build with Visual Studio in Windows, and you may also be able to run and debug your code on Windows, but you will not be able to deploy files built in Visual Studio. For final deployable builds, you will need to move the code you developed in Visual Studio to an OpenVMS development machine.