| DC-API Manual |
|---|
The DC-API library uses the pkg-config system to help
the building of applications. For every backend, two
pkg-config modules are available:
dcapi-
for building client applications and
<backend>-clientdcapi-
for building master applications.
<backend>-master
During compilation, the pkg-config --cflags
<module> command gives the
list of compiler directives (like include file locations) that have to be
passed to the compiler whenever one of the DC-API headers is referenced in
a source file.
During linking, the pkg-config --libs
<module> command will return
the list of libraries and linker options required to link the application
with DC-API.
If you have built DC-API from source and have installed it at a
non-standard location (i.e. not under /usr or
/usr/local), you may have to set the
PKG_CONFIG_PATH environment variable to point to the
directory where the .pc files are located in order
to pkg-config to find them.
Microsoft Visual Studio 7.1
DC-API library and header files
Zip file containing the skeleton for an application
Unzip the contents of the attached zip file. Copy the following three
header files of the DC-API in the include directory: dc_client.h, dc_common.h, dc_win32.h. Copy the following library
file of the DC-API in the lib
directory: dc_client.lib.
The source code of the application goes into the src directory, which already contains an
application skeleton. The Visual Studio Related files are in the win_build directory.
Open the application.sln file in Microsoft Visual
Studio 7.1 (MVS from now on). Open up the 'Soultion Explorer' window in
MVS, if it is not open yet
(Ctrl-Alt-L).
In the 'Solution Explorer' window you will see the Solution called
'application' to which several subdirectories belong.
Open up the Source Files
subdirectory to check that application.c is already
added to the solution. Double click on application.c
to open it up in MVS. Similarily, the header files are located in the
Header Files subdirectory.
If you want to add more header or source files, put them in the
include or the src directories, respectively. After the
files are settled in place right click on the Source Files in the 'Solution Explorer'
and choose
->
from the menu to add the source files. Do the same for the header files
to add them to the Header Files
directory.
The source file application.c already contains the
neccessary include files and some basic functions for an application
utilizing the DC-API to compile. The source is structured in an
intuitive way. You can use these functions to realize the several
functions of a BOINC application (like checkpointing) or you can clear
these and develop your own methods.
The skeleton 'application' solution is set up to compile with the DC-API. In the middle part on the menu of MVS there is a drop down box showing or . With this drop down box, you can select different configurations to compile your application with. Before compiling set this to the appropriate configuration.
If you compile in mode,
you'll be able to debug the application by visually stepping through the execution,
however, the executable will be bigger and will not be optimalized.
Use this mode for debugging only.
If you compile in mode,
the executable will be optimalized, resulting in a faster and smaller code,
however, you'll not be able to visually debug your applcation.
Use this mode for compiling release versions.
To compile the application select from the menu or press F7. During compilation you will see an output window showing the progress of the compilation.
If compilation fails the last line of the output window will show:
Build: 0 succeeded, 1 failed, 0 skipped
Scroll back in the 'Output Window' to locate the problem and correct it as neccessary.
If compilation is successful the last line of the output window will show:
Build: 1 succeeded, 0 failed, 0 skipped
During compilation a subdirectory is created in the win_build
directory of the repository having the same name as the current
configuration (Debug or Release) You will find the compiled executable
in these subdirectories with the name
application_1.00_windows_intelx86.exe.
If the application is successfully compiled in
mode, you can debug it visually. During
debugging the current directory where the application will look for its
input and output files will the win_build directory. Copy the input files
of the application in the win_build directory. Select
from the
menu to start debugging or press F11. If the
application is outdated, MVS will ask to recompile it, select
. The applcation will be started and you
will see a yellow arrow pointing to the current line of code to be
executed. Keep pressing F11 to step through the program
lines. If the next call is a function, you can skip the function
by pressing F10 ()
and continue debugging on the point where the function returns.
You can set breakpoints in the code by clicking on the grey area next to the program line, where the yellow arrow moves during debugging. A big red dot appears marking a breakpoint.
To clear the breakpoint click on the big red dot or select (Ctrl-Shift-F9) from the 'Debug' menu. You can start the application in debug mode by selecting from the menu, or by pressing F5. Execution will be breaken on the point where you have set breakpoints. To continue execution after a breakpoint press F5.
To stop debugging press Shift-F5 or select the item in the menu of MVS.
You can change the properties of 'Debug' and 'Release' modes by right clicking on the 'applcation' in the 'Solution Explorer' window and selecting . However, the configuration is already set up to best suit the needs of application development with DC-API so in most cases no configuration option is needed to be changed.
| << Configuration | Backend-specific information >> |