C++ Plugins

Introduction

With the C++ Plugin capability, users may create custom FISH intrinsics and contact models in C++ to be loaded at runtime. Plugins are compiled as DLL (dynamic link library) files and provide several distinct advantages over FISH code:

  1. C++ functions generally execute 10 to 100 times faster than the equivalent FISH functions.
  2. Users familiar with concurrent programming can produce plugins that execute even faster on multiprocessor hardware.
  3. Direct access is provided to internal data structures and methods that are not available via predefined FISH intrinsics or contact models.
  4. A C++ plugin can link to, and make use of, any other C++ library or DLL it requires.

In the C++ language, the emphasis is on an object-oriented approach to program structure via the use of classes to represent objects. The data associated with an object are encapsulated by the object and are invisible outside of the object. Communication with the object is by member functions that operate on the encapsulated data. In addition, there is strong support for a hierarchy of objects. New object types may be derived from a base object, and the base-object’s member functions may be superseded by similar functions provided by the derived objects. This arrangement confers a distinct benefit in terms of program modularity. For example, the main program may need access to many different varieties of derived objects in many different parts of the code, but it is only necessary to make reference to base objects, not to the derived objects. The runtime system automatically calls the member functions of the appropriate derived objects. A good introduction to programming in C++ is provided by [Stevens2000]. What follows assumes that the reader has a working knowledge of the C++ programming language.

In order for a compiled DLL to be compatible with PFC, it must be compiled using Microsoft Visual Studio 2017 15.7 or later. The interface also requires the use of Qt version 5.12, a C++ utility library. A discussion of Qt installation is given below.

References

[Stevens2000]Stevens, A. Teach Yourself C++, 6th Ed. Foster City, CA : IDG Books Worldwide, 2000.