Hitachi

JP1 Version 13 JP1/Base Function Reference


2.2.3 Compiling the source files

To issue and acquire JP1 events, you must first compile and link the code source files.

Files needed for compiling:
  • JP1/Base header file (installed when JP1/Base is installed)

  • Source files created in C or C++ (user-created files)

The location of the header file is as follows:

Windows: installation-folder\include\JevApi.h

UNIX: /opt/jp1base/include/JevApi.h

Files needed for linking:
  • Libraries (installed when JP1/Base is installed)

Note that the required libraries vary by OS and by compiler. The following table lists the libraries required for each OS.

Further, there are two types of libraries: 2038-non compliant and 2038-compliant libraries. Link to a 2038-compliant library if you intend to continue use in 2038 and beyond.

Table 2‒4: Libraries required for each OS (2038-non compliant)

OS

Threading

Required library

Windows

32-bit multi-threaded

installation-folder\lib\libJevApiA.lib

64-bit multi-threaded

installation-folder\lib\libJevApiAx64.lib

  • AIX

  • Linux

32-bit single-threaded

/opt/jp1base/lib/libJevApiAst.a

32-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt.a

64-bit single-threaded

/opt/jp1base/lib/libJevApiAst64.a

64-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt64.a

Table 2‒5: Libraries required for each OS (2038 compliant)

OS

Threading

Required library

Windows

32-bit multi-threaded

installation-folder\lib\libJevApiAT.lib

64-bit multi-threaded

installation-folder\lib\libJevApiATx64.lib

  • AIX

  • Linux

32-bit single-threaded

/opt/jp1base/lib/libJevApiATmt.a

32-bit multi-threaded

/opt/jp1base/lib/libJevApiATst.a

64-bit single-threaded

/opt/jp1base/lib/libJevApiATmt.a

64-bit multi-threaded

/opt/jp1base/lib/libJevApiATst64.a

The table below lists for each OS the options to specify when compiling and linking the source files.

Further, there are two types of link options: 2038-non compliant and 2038-compliant link options. Use a 2038-compliant link option if you intend to continue use in 2038 and beyond.

Note:

When you compile and link source files in Visual Studio Integrated Development Environment (GUI) for Windows, use options that are appropriate for configuring the environment, from among the compile and link options listed in the tables below.

Table 2‒6: Compile options

OS

Threading

Compile option

Windows

32-bit multi-threaded

/MD /I "installation-folder\include"

(Implement in a 32-bit VC++ project configuration)

64-bit multi-threaded

/MD /I "installation-folder\include"

(Implement in a 64-bit VC++ project configuration)

AIX

32-bit single-threaded

-I/opt/jp1base/include

32-bit multi-threaded

-D_REENTRANT -D_THREAD_SAFE -I/opt/jp1base/include

64-bit single-threaded

-q64 -I/opt/jp1base/include

64-bit multi-threaded

-q64 -D_REENTRANT -D_THREAD_SAFE -I/opt/jp1base/include

Linux

32-bit single-threaded

-I/opt/jp1base/include

32-bit multi-threaded

-D_REENTRANT -D_THREAD_SAFE -I/opt/jp1base/include

64-bit single-threaded

-m64 -I/opt/jp1base/include

64-bit multi-threaded

-m64 -D_REENTRANT -D_THREAD_SAFE -I/opt/jp1base/include

#: The -Aa option for HP-UX (IPF) is needed only when you use the C compiler (cc) to compile. You can replace the -Aa option with the -Ae option, but do not specify the -Ac option. The -Aa option can be omitted if you use the C++ compiler (aCC).

Table 2‒7: Link options (2038 non-compliant)

OS

Threading

Link option

Windows

32-bit multi-threaded

"installation-folder\lib\libJevApiA.lib"

(Implement in a 32-bit VC++ project configuration)

64-bit multi-threaded

"installation-folder\lib\libJevApiAx64.lib"

(Implement in a 64-bit VC++ project configuration)

AIX

32-bit single-threaded

/opt/jp1base/lib/libJevApiAst.a -ldl

32-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt.a -ldl -lpthread

64-bit single-threaded

/opt/jp1base/lib/libJevApiAst64.a -q64 -ldl

64-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt64.a -q64 -ldl -lpthread

Linux

32-bit single-threaded

/opt/jp1base/lib/libJevApiAst.a -ldl

32-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt.a -ldl -lpthread

64-bit single-threaded

/opt/jp1base/lib/libJevApiAst64.a -m64 -ldl

64-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt64.a -m64 -ldl -lpthread

Table 2‒8: Link options (2038-compliant)

OS

Threading

Link option

Windows

32-bit multi-threaded

"installation-folder\lib\libJevApiAT.lib"

(Implement in a 32-bit VC++ project configuration)

64-bit multi-threaded

"installation-folder\lib\libJevApiATx64.lib"

(Implement in a 64-bit VC++ project configuration)

AIX

32-bit single-threaded

/opt/jp1base/lib/libJevApiATst.a -ldl

32-bit multi-threaded

/opt/jp1base/lib/libJevApiATmt.a -ldl -lpthread

64-bit single-threaded

/opt/jp1base/lib/libJevApiATst64.a -q64 -ldl

64-bit multi-threaded

/opt/jp1base/lib/libJevApiATmt64.a -q64 -ldl -lpthread

Linux

32-bit single-threaded

/opt/jp1base/lib/libJevApiATst.a -ldl

32-bit multi-threaded

/opt/jp1base/lib/libJevApiATmt.a -ldl -lpthread

64-bit single-threaded

/opt/jp1base/lib/libJevApiATst64.a -m64 -ldl

64-bit multi-threaded

/opt/jp1base/lib/libJevApiATmt64.a -m64 -ldl -lpthread

Notes:
  • The libraries provided by JP1/Base are static libraries (or an archive for UNIX). They are not DLL import libraries or shared libraries.

  • The libraries provided by JP1/Base are dynamically loaded by means of a DLL (or a shared library for UNIX) bundled with JP1/Base. This means that created programs will run on a machine on which JP1/Base is not installed, but certain functions will fail with a JEV_NO_LIBRARY error.

  • DLLs dynamically loaded from the libraries provided by JP1/Base for Windows are independent of the libraries packaged with side-by-side assembly, so no manifest is provided.

  • Do not use the -l option when linking the libraries provided by JP1/Base on UNIX.

  • When linking on UNIX, we recommend that you use the same linkage editor you used for the compiling (cc, for example), rather than using ld. If you do use ld to link the files, specify the same options in the same order as the compiler when it automatically passes to ld.

  • To compile source files in the Linux x64 environment, add -m32 to the compile options and link options.

  • If the environment in which a program is run, the environment where the program is run is different from that in which the program was built (compiled and linked), the build environment. The versions of the OS or the OS patches for the run environment must be the same or later than those of the build environment. A program might not execute normally when the OS or OS patches in the run environment are earlier than those for the build environment. (Example: A symbol solution error occurs and the program cannot be started normally.)

  • To use the JevGetRegistTime() function and JevGetArrivedTime() function as functions returning time_t type return values, specify D_JEVTIME_T as the compile option.