ActivePivot being a Java solution, how can I re-use existing C++ libraries in it?
I consider a CVA (CounterParty Value Adjustment) project based on ActivePivot and I would like to reuse my existing C++ code to apply my Collateral logic on array of doubles aggregates by ActivePivot. Is there a special post-processor to call C++ code?
An ActivePivot post-processor is a normal Java class. There is nothing special about it. So you can use any existing technique so call a C++ DLL function while inside a Java program.
This can be achieve for instance with JNA and BridJ. I don’t consider JNI as in most cases, you don’t need to use such a low-level API.
For instance, with BridJ:
Given a C++ header looking like:
I made the following class:
and my IPostProcessor is simply
In term of performance, here I worked on 2.000 double[] of size 10000 and the impact is of about 100ms