# C Programmer’s Checklist

Developers of EMS C programs can use this checklist during the five phases of the development cycle.

## Install

Install the EMS software release, which automatically includes the EMS client libraries, binaries, and header files in the EMS_HOME/lib subdirectory.

## Code

Application programs must:

- Add EMS_HOME/include to the include path. (OpenVMS environments do not require an include path; skip this item.)
- Include the `tibems.h` header file:

          #include <tibems/tibems.h>

- Programs that use the C administration API must also include the `emsadmin.h` header file:

          #include <tibems/emsadmin.h>

- Programs that use the unshared state failover API must also include the `tibufo.h` header file:

          #include <tibems/tibufo.h>

- Call `tibems_Open()` to initialize the EMS C API and `tibems_Close()` to deallocate the memory used by EMS when complete.

## Compile and Link

- Compile programs with an ANSI-compliant C compiler.
- Link with the appropriate EMS C library files; see Link These Library Files.

See the `samples/c/readme.txt` file for details.

## Run

- UNIX
    If you use dynamic EMS libraries on a UNIX platform, the environment variable `$LD_LIBARY_PATH` must include the EMS_HOME/lib directory (which contains the shared library files). (On some UNIX platforms, this variable is called `$SHLIB_PATH` or `$SYLIB_LIBRARY_PATH`).
- Windows
    The PATH must include the ems\8.5\bin directory.
- OpenVMS
    The installation procedure automatically installs the shareable images required for using EMS dynamic libraries.
- All Platforms
    The application must be able to connect to a EMS server process (`tibemsd`).

## Link These Library Files

EMS C programs must link the appropriate library files. The following sections describe which files to link for your operating system platform:

- UNIX
- Microsoft Windows
- OpenVMS

## UNIX

In UNIX environments, both shared and static libraries are available. We recommend shared libraries to ease forward migration.

Include TIBCO_HOME/ems/8.5/lib/64 in your library path.

Linker Flag | Description
--- | ---
`-ltibems64` | All programs must link using this library flag.
`-lssl -lcrypto` | Programs that use SSL must link using these library flags.
`-lz` | Programs that use compression must link using this library flag.
`-ltibemslookup64 -lldap -lxml2 -llber` | Programs that use EMS LDAP lookup must link using these library flags.
`-ltibemsadmin64` | Programs that use the C administration library must link using this library flag.
`-ltibemsufo64` | Programs that use the unshared state failover library must link using this library flag.

## Microsoft Windows

For a list of Windows platforms that Release 8.5 supports, see the file `readme.txt` in the installation directory. Both DLLs and static libraries are available. We recommend DLLs to ease forward migration.

Library File | Description
--- | ---
With dynamic libraries (DLLs), use the `/MT` compiler option.
`tibems.lib libeay32.dll ssleay32.dll` | All programs must link these libraries.
`tibemslookup.lib libxml2.lib` | Programs that use EMS LDAP lookup must link these libraries.
`liboldap32.lib libolber32.lib` | In addition, programs that use EMS lookup must link these libraries.
`tibemsadmin.lib` | Programs that use the C administration library must link using this library.
`tibemsufo.lib` | Programs that use the C unshared state failover library must link using this library.

Note: The version of the `libeay32.dll` shared library that is included with EMS is built to optionally support FIPS. This has a side-effect of preventing its relocation in a process address space during run time.

If your Windows application fails to start due to a relocation error, try these workarounds:

Relink your application with the `/FIXED` flag.

Relink your application with static libraries.

Library File | Description
--- | ---
With static libraries (DLLs), use the `/MD` compiler option.
`libtibems.lib ssleay32mt.lib libeay32mt.lib zlib.lib` | All programs must link these libraries.
`libtibemsadmin.lib` | Programs that use the C administration library must link using this library.
`libtibemsufo.lib` | Programs that use the C unshared state failover library must link using this library.

Note: Programs that perform JNDI lookups, whether they use LDAP or not, cannot be statically linked on Windows. Use dynamic linking instead.

## OpenVMS

In OpenVMS environments, both shared and static libraries are available. We recommend shared libraries to ease forward migration.

Shareable Image Library Files for OpenVMS
Library File | Description
--- | ---
`LIBTIBEMSSHR.EXE` | All programs must link this library.
`LIBCRYPTOSHR.EXE` `LIBSSLSHR.EXE` | Programs that use SSL must link these libraries.
`LIBZSHR.EXE` | Programs that use data compression must link this library.
`LIBTIBEMSADMINSHR.EXE` | Programs that use the C administration library must link this library.
`LIBTIBEMSUFOSHR.EXE` | Programs that use the C unshared state failover library must link using this library.

Static Library Files for OpenVMS
Library File | Description
--- | ---
`LIBTIBEMS.OLB` | All programs must link this library.
`LIBCRYPTO.OLB` `LIBSSL.OLB` | Programs that use SSL must link these libraries.
`LIBZ.OLB` | Programs that use data compression must link this library.
`LIBTIBEMSADMIN.OLB` | Programs that use the C administration library must link this library.
`LIBTIBEMSUFO.OLB` | Programs that use the C unshared state failover library must link using this library.

Copyright © Cloud Software Group, Inc. All rights reserved.