Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8579859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:42:05+00:00 2026-06-11T20:42:05+00:00

ActivePivot being a Java solution, how can I re-use existing C++ libraries in it?

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:42:06+00:00Added an answer on June 11, 2026 at 8:42 pm

    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:

    __declspec(dllexport) int multiply(double multiplier, int size, double* const vector);
    

    I made the following class:

    import org.bridj.BridJ;
    import org.bridj.Pointer;
    import org.bridj.ann.Library;
    import org.bridj.ann.Runtime;
    import org.bridj.cpp.CPPRuntime;
    
    // Generated with http://code.google.com/p/jnaerator/
    @Library(CPP_Collateral.JNA_LIBRARY_NAME)
    @Runtime(CPPRuntime.class)
    public class CPP_Collateral {
    public static final String JNA_LIBRARY_NAME = "dummy";
    
    static {
        // In eclipse, the DLL will be loaded from a resource folder
        // Else, one should add a program property: -Djava.library.path
        BridJ.addLibraryPath("src/main/resources/DLL");
    
        BridJ.register();
    }
    
    /**
     * My dummy.dll has one method:
     * int multiply(double multiplier, int size, double* const vector)
     */
    public static native int multiply(double multiplier, int size, Pointer<Double> vector);
    }
    

    and my IPostProcessor is simply

    @Override
    protected Object doEvaluation(ILocation location, Object[] underlyingMeasures) throws QuartetException {
        double[] asArray = (double[]) underlyingMeasures[0];
    
        if (asArray == null) {
            return null;
        } else {
            // Size of the array
            int size = asArray.length;
    
            // Allocate a Pointer to provide the double[] to the C++ DLL
            Pointer<Double> pCount = allocateDoubles(size);
    
            pCount.setDoubles(asArray);
    
            CPP_Collateral.multiply(2D, size, pCount);
    
            // Read again: the double[] is copied back in the heap
            return pCount.getDoubles();
        }
    }
    

    In term of performance, here I worked on 2.000 double[] of size 10000 and the impact is of about 100ms

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I consider an ActivePivot instance to compute CVA (Credit Valuation Adjustment). I have to
Starting from ActivePivot Sandbox 4.3.2 I changed my object feeding into the cube and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.