|
|
C++ |
To compile C++ code that uses OrcFxAPI you need to include the header file OrcFxAPI.h. This header file contains declarations of the DLL's data structures, types, constants and functions.
In addition you need to link to the DLL, for which there are two options:
OrcFxAPI.lib. You must pass this import library to the linker during the link stage of your build process.OrcFxAPIExplicitLink.c. In addition you will need to take charge of loading the DLL, typically with a call to LoadLibrary. Before calling any OrcFxAPI functions you must make a call to InitializeOrcFxAPI passing the module handle of the OrcFxAPI DLL.Note that there are special linking requirements for external function DLLs.
When using load-time dynamic linking, the loader will use the DLL search order to locate the OrcFxAPI DLL. Older versions of OrcaFlex installed the OrcFxAPI DLL to the Windows system directory. Starting with OrcaFlex 9.6, the DLL is no longer installed to the Windows system directory. Instead the installation program places the DLL under the OrcaFlex installation directory, in directories named OrcFxAPI\Win32 and OrcFxAPI\Win64. The Win32 directory contains 32 bit versions of DLL and LIB files; the Win64 directory contains the 64 bit files.
In order for your program to be able to load the OrcFxAPI DLL, it follows therefore that it must be found in the DLL search order. The recommended way to meet this requirement is to place the OrcaFlex DLL in the same directory as your program's executable file.
For run-time dynamic linking, you are responsible for specifying the location of the DLL. Either rely on the DLL search order by passing "OrcFxAPI.dll" to LoadLibrary, or specify the full path to the DLL.
Starting with version 11.0, the OrcFxAPI DLL's dependencies must be located alongside the DLL. These dependencies are packaged as a Windows assembly, installed to directories named OrcFxAPI\Win32\lib32 and OrcFxAPI\Win64\lib64. If you copy the OrcFxAPI DLL to a location away from its installation directory (e.g. to your program's executable directory), then you must also copy the appropriate dependencies (lib32 or lib64 depending on the bitness of the DLL) to the same location.
If the OrcFxAPI DLL is unloaded other than during process termination, then you should call C_FinaliseLibrary immediately before the DLL is unloaded. Note that you must not call C_FinaliseLibrary while inside a DllMain function.
The OrcFxAPI.h header file presents a purely functional interface which is designed to be accessible from C code as well as from C++. This interface exposes the raw low-level interface to OrcaFlex and as such is not very convient to use.
We also provide an experimental, unsupported interface for C++. This is an object oriented wrapper around the low-level interface and is supplied in the form of C++ source code that sits on top of OrcFxAPI.h. This interface can be accessed from a C++ project simply by adding the source files, OrcFxAPI_wrapper.h and OrcFxAPI_wrapper.cpp, to the project. The code is written for C++11 and is not expected to work with older versions of the language. This wrapper only supports Unicode text.
We stress that the object oriented interface is purely experimental and is supplied on an unsupported, as-is basis. It is not documented, although it is very similar to the Python and MATLAB interfaces. This interface is incomplete in that not all functionality of OrcFxAPI has been implemented. However, in spite of all these provisos, we feel that this interface could be useful in some circumstances.