Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP WBEM Services Software Developer's Kit for HP-UX Provider and Client Developer's Guide > Chapter 4 Provider Implementation

Building Providers

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

For detailed information on the following material, please refer to the documentation for the HP-UX C++ compiler (aCC) and linker (ld) at http://www.docs.hp.com/hpux/dev.

The provider C++ source file must be compiled with the aCC compiler. The options are:

  • -c (optional)

    Causes the compiler to stop after the compilation phase and generate an object file output (.o) instead of continuing on to the link phase. This flag is inserted automatically when using implicit rules in the make utility (see the man page for make(1) for more information).

  • -mt

    Instructs the compiler to generate symbols and macros needed to support multi-threaded operation

  • +Z

    Produces position independent code (PIC) necessary to build a dynamic shared library

  • +DAportable (PA only)

    Generates code for any HP9000 hardware architecture (although the generated code may execute slightly more slowly, this is strongly recommended, because products compiled for specific architectures must be generated for each architecture and packaged as separate products or as single products with multiple, architecture-specific file sets)

  • +DD64 (IA only)

    Generates code using the LP64 model.

  • -AP (PA only)

    Turns off AA mode; uses the older classic C++ runtime libraries.

  • -AA (IA only)

    Turns on newly suppported ANSI C++ Standard features, such as namespace std and the new C++ Standard Library.

  • -I/opt/wbem/include

    Instructs the compiler where to look for header files that are needed to compile providers

  • -DPEGASUS_PLATFORM_HPUX_PARISC_ACC (PA)
    -DPEGASUS_PLATFORM_HPUX_IA64_ACC (IA)

    Defines compile-time macro needed to control conditional compilation on HP-UX

The shared library should be linked with the aCC command using the following options (shared libraries could also be linked with the ld command, but using aCC automatically links the necessary C/C++ standard run-time libraries):

  • -b

    Generates a shared library, rather than an executable image

  • -Wl,+hlib<name>.<library_suffix>

    Passes the +h flag to the linker, which causes the specified string to be inserted in the shared library as its internal name (please see the man page for the ld command). This feature, while not absolutely required, allows management of different versions of a shared library, in that programs can be built to run with versions at or later than a specified value.

    The <name> string should match the Location property value of the PG_ProviderModule registration object. The extension <library suffix> must be the appropriate shared library suffix for the platform. Use .sl for PA, or .so for IA; for example:

    -Wl,+hlibMyProviderModule.sl
    or
    -Wl,+hlibMyProviderModule.so

    The same string should be specified as the output file to be generated by the linker with the -o flag:

    -olibMyProviderModule.0 
  • -L/opt/wbem/lib

    Instructs the linker to look in /opt/wbem/lib for the following shared libraries that will be dynamically accessed during execution

  • -lpegcommon
    -lpegprovider

    Inserts into the list of dynamically linked shared libraries:

    • For PA: /opt/wbem/lib/libpegcommon.sl and /opt/wbem/lib/libpegprovider.sl

    • For IA: /opt/wbem/lib/libpegcommon.so and /opt/wbem/lib/libpegprovider.so

Other options may be specified, as needed, as long as they do not conflict with those shown above.

The following example shows a Makefile constructed according to the previous discussion.

Example 4-11 Makefile Example

MODULE = MyProviderModule
OUTFILE = lib$(MODULE).sl
CXX = aCC
## -c not needed in CXXFLAGS because it's always used
## automatically by make when using implicit compile rules
CXXFLAGS= -mt +Z +DAportable \
-I/opt/wbem/include
-DPEGASUS_PLATFORM_HPUX_PARISC_ACC
LD = aCC
LDFLAGS = -b -Wl,+h$(OUTFILE)
LIBS = \
-L/opt/wbem/lib \
-lpegcommon \
-lpegprovider \
-lpthread \
-lrt
OBJS = MyProviderMain.o MyProvider.o
$(OUTFILE) : $(OBJS)
$(LD) -o$@ $(LDFLAGS) $(OBJS) $(LIBS)
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2000-2003 Hewlett-Packard Development Company, L.P.