UltraLite Static C++ User's Guide
Tutorial: Build an Application Using the C++ API
You can compile and link your application in the development tool of your choice. In this section, we describe how to compile and link using Visual C++; if you are using one of the other supported development tools, modify the instructions to fit your tool.
Start Microsoft Visual C++ from your desktop in the standard fashion.
Configure Visual C++ to search the appropriate directories for UltraLite header files and library files.
Select Tools
C:\Program Files\Sybase\SQL Anywhere 9\h
On the same tab, select Library Files under the Show Directories For dropdown menu. Include the following directory so that the UltraLite library files can be accessed.
C:\Program Files\Sybase\SQL Anywhere 9\ultralite\win32\386\lib
Click OK to submit the changes.
Create a project named APITutorial (it should have the same name as the directory you have used to hold your files).
Select File
On the Projects tab choose Win32 Console Application.
Specify a project name of APITutorial.
Specify the APITutorial directory as its location.
Select Create a New Workspace and click OK.
Choose to create An Empty Project and click Finish.
On the Workspace window, click the FileView tab. The workspace tutorial consists of just the APITutorial project. Double-click APITutorial files to display the three folders: Source Files, Header Files, Resource Files.
Configure the project settings.
Right-click APITutorial files and select Settings.
The Project Settings dialog is displayed.
From the Settings For dropdown menu, choose All Configurations.
Click the Link tab. Add the following runtime library to the Object/Library Modules box.
ulimp.lib
Click the C/C++ tab. From the Category dropdown menu, choose General. Add the following to the Preprocessor definitions list:
__NT__,UL_USE_DLL
Here, __NT__ has two underscores either side of NT.
Click OK to finish.
Add sample.cpp and ProductPubAPI.cpp to the project.
Right-click the Source Files folder and select Add Files to Folder. Locate sample.cpp and click OK. Open the Source Files folder to verify that it contains sample.cpp.
Repeat to add the generated ProductPubAPI.cpp file to the project.
Add the file containing the base classes for the UltraLite API to the project.
Right-click the Source Files folder and choose Add Files to Folder. Browse to ulapi.cpp, located in the src subdirectory of your SQL Anywhere installation. Click OK.
Compile and link the application.
Select Build
Run the application.
Select Build
A command prompt window appears and displays the prices of the products in the product table.
You have now built and run a simple UltraLite application. The next step is to add synchronization to your application.