Hitachi

JP1 Version 12 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.

Table 2‒4: Libraries required for each OS

OS

Threading

Required library

Windows

32-bit multi-threaded

installation-folder\lib\libJevApiA.lib

64-bit multi-threaded

installation-folder\lib\libJevApiAx64.lib

HP-UX (IPF)

32-bit single-threaded

/opt/jp1base/lib/libJevApiAst32.a

32-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt32.a

64-bit single-threaded

/opt/jp1base/lib/libJevApiAst64.a

64-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt64.a

Solaris (SPARC)

32-bit single-threaded

/opt/jp1base/lib/libJevApiAst.a

32-bit multi-threaded

/opt/jp1base/lib/libJevApiAmt.a

  • 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

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

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‒5: 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)

HP-UX (IPF)

32-bit single-threaded

-Aa# -I/opt/jp1base/include

32-bit multi-threaded

-Aa# -mt -I/opt/jp1base/include

64-bit single-threaded

+DD64 -Aa# -I/opt/jp1base/include

64-bit multi-threaded

+DD64 -Aa# -mt -I/opt/jp1base/include

Solaris (SPARC)

32-bit single-threaded

-I/opt/jp1base/include

32-bit multi-threaded

-mt -D_THREAD_SAFE -I/opt/jp1base/include

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‒6: Link options

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)

HP-UX (IPF)

32-bit single-threaded

/opt/jp1base/lib/libJevApiAst32.a

32-bit multi-threaded

-mt /opt/jp1base/lib/libJevApiAmt32.a

64-bit single-threaded

+DD64 /opt/jp1base/lib/libJevApiAst64.a

64-bit multi-threaded

+DD64 -mt /opt/jp1base/lib/libJevApiAmt64.a

Solaris (SPARC)

32-bit single-threaded

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

32-bit multi-threaded

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

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

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.)