Loading ...

How to Load a C++ Library into Acumatica

Integrating a C++ library into Acumatica can enhance the application’s functionality by leveraging native code for performance-critical tasks. This guide explains how to dynamically load a C++ library into an Acumatica graph using .NET’s interop capabilities, including a real-world example.


Loading native libraries into a managed .NET application like Acumatica often involves challenges related to runtime management. By implementing a dynamic loading mechanism, you can improve the performance and flexibility of your customizations.

Unmanaged Library Loader Implementation

The following example demonstrates a simplified approach to dynamically load and interact with a C++ library. The UnmanagedLibrary abstract class provides the foundation for platform-specific implementations:

Real-World Example: Integration with Acumatica Graph

Consider a scenario where your C++ library provides specialized mathematical functions, such as adding or multiplying numbers, which need to be accessible from within an Acumatica graph.

Here’s how to integrate and use the WindowsLibrary class in an Acumatica graph:

In this example:

  • The WindowsLibrary dynamically loads a library named MyCppLibrary.dll.
  • The ExecuteLibraryFunction method retrieves a function pointer for AddNumbers and executes it.
  • Any issues during loading or execution are logged using Acumatica’s PXTrace utility.

Windows-Specific Implementation

Since Acumatica runs in a Windows environment, the above implementation uses the WindowsLibrary class, which relies on the Windows API for dynamic library loading. Key functions used include:

  • LoadLibrary: Loads the specified DLL.
  • FreeLibrary: Frees the loaded DLL.
  • GetProcAddress: Retrieves the address of an exported function from the DLL.

This implementation ensures seamless integration of C++ libraries while leveraging Windows-native functionality.

Deployment Considerations

  • Library Path: Ensure the native library is placed in a location accessible by the application.
  • Error Handling: Include robust error-handling mechanisms to address scenarios like missing libraries or incorrect function signatures.
  • Testing: Test the integration thoroughly in the Acumatica Windows environment.

By adopting this approach, you can extend Acumatica’s capabilities with the performance and functionality of native code, enabling your application to meet advanced business requirements efficiently.

Be the first to rate this post

  • Currently 0.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5