next up previous contents
Next: References Up: The Shore Storage Manager Interface Previous: Miscellaneous Facilities

Subsections
 

Writing and Compiling a VAS and Client

This section discusses some of the general issues in compiling and linking with the SSM libraries. The best way to learn about writing and compiling a VAS and client is to read the VAS Tutorial, Writing Value-Added Servers with the Shore Storage Manager.

 

Include Files and Libraries

All of the include files needed to build servers and clients are located in SHROOT/include. Any server code using the SSM should include sm_vas.h. Since clients do not need all of the SSM functionality, they need only include sm_app.h. The RPC package include files are located in SHROOT/include/rpc and are usually included with this line:

    #include <rpc/rpc.h>

Note: The Solaris version of Shore uses the standard Solaris version of the rpc libraries.

All of the libraries needed to build servers and clients are located in SHROOT/lib. Clients only need libshorecommon.a. Servers need both libsm.a and libshorecommon.a The RPC package library is librpclib.a (except for Solaris).

There are two pre-compiled version of these libraries. The are included in the debugging and no-debugging binary releases. The debugging version not only includes symbol table information (-g option to gcc), but also has considerable additional auditing and assert checking code. This includes code that audits data pages whenever an update is made, performs monitoring to detect thread stack overflow, and checks over 1,400 additional assertions. See the Shore Release document for more information on these releases.

Note: Use the -DDEBUG flag when compiling for linkage with the debugging release.

 

Template Instantiation

The SSM uses several C++ templates One of the issues that is often confusing is controlling template instantiation. All of the template instantiations needed by the SSM are already included in the libraries.

However, due to a bug in gcc 2.6.* (supposedly to be fixed in 2.7.0), it is possible to have problems during linking due to multiple definitions of template code. To avoid this, and to have smaller executables, we use the gcc option -fno-implicit-templates in the Makefile from the tutorial example. This causes gcc not to emit any template code unless the template is explicitly instantiated.

Here is an example of explicit instantiation from the tutorial

    #ifdef __GNUG__
    // Explicitly instantiate lists of client_t.
    template class w_list_t<client_t>;
    #endif

(We haven't checked whether this is still necessary with version 2.7 of g++, but if it ain't broke, why fix it?)

 

Other Example Code

The SSM has been used to build a few value-added servers. Some of these are publicly available. You may find these helpful in writing your own.


next up previous contents
Next: References Up: The Shore Storage Manager Interface Previous: Miscellaneous Facilities
This page was generated from LaTeX sources
10/27/1997