Sun Java System Web Server 7.0 Update 3 NSAPI Developer's Guide

Compiler Flags

The following table lists the flags and defines you need to use for compilation of your source code.

Solaris SPARC

-DXP_UNIX -D_REENTRANT -KPIC -DSOLARIS

Windows

-DXP_WIN32 -DWIN32 /MD

HP-UX

-DXP_UNIX -D_REENTRANT -DHPUX

AIX

-DXP_UNIX -D_REENTRANT -DAIX $(DEBUG)

Compaq

-DXP_UNIX -KPIC

Linux

-DXP_UNIX -D_REENTRANT -fPIC

IRIX

-o32 -exceptions -DXP_UNIX -KPIC

Compiling and Linking in 64–bit Mode

On the Solaris platform, the server can run in either 32–bit or 64–bit mode. Because a 32–bit shared library cannot be used in a 64–bit process and conversely, you may want to compile and link two separate shared libraries. By default, the Sun compiler and linker produce 32–bit binaries. To compile and link your plug-in for 64–bit mode on Solaris SPARC, you must use Sun Workshop 5.0 or higher with the -xarch=v9 flag. To compile and link your plug-in for 64–bit mode on Solaris x86, you must use Sun Java Studio 11 or higher with the -xarch=amd64 flag.

Issues With Using C++ in a NSAPI Plug-in

NSAPI plug-ins are typically written using the C programming language. Using the C++ programming language in an NSAPI plug-in raises special compatibility issues.

On Solaris, the server is built using the new C++ 5 ABI. If your shared library uses C++, it must be compiled with Sun Workshop 5.0 or higher. Sun Java Studio 11 or higher is recommended. Do not use the -compat=4 option when compiling and linking a shared library that uses C++. When running in 32–bit mode on Solaris SPARC, the server provides some backward compatibility for the old C++ 4 ABI or Sun Workshop 4.2. This backward compatibility may be removed at some future date. For all new NSAPI plug-ins, use the new C++ 5 ABI or Sun Workshop 5.0 or later versions.

On Linux, Web Server is built using the gcc 3.2 C++ ABI. If your shared library uses C++, compile with gcc 3.2.x. Because of the volatility of the gcc C++ ABI, avoid using C++ in NSAPI plug-ins on Linux.