openkim/kimpy

Binary Compatible Interfaces Across Compilers

Opened this issue · 3 comments

If the KIM-API library is compiled with Compiler A and in the process of building a kimpy, we use a Compiler B, it will end with an error. The issue is that C++ generally breaks binary compatibility across different compilers, usually due to name mangling, object layout, exception support.

A way to get around this is to update the kimpy interface to use the KIM-API C-style interface, similar to the KIM-API integration in the LAMMPS implementation.

mjwen commented

@yafshar I am not too familiar with compiling with multiple compilers and have a question: Even if we switch to use C API of KIM-API, the binding code itself is still C++. Will this solve the issue?

@yafshar I am not too familiar with compiling with multiple compilers and have a question: Even if we switch to use C API of KIM-API, the binding code itself is still C++. Will this solve the issue?

@mjwen Yes, this is similar to the KIM-API interface in LAMMPS. Using a C-style interface approach allows you to compile KIM-API in 1 compiler and call it from kimpy which is compiled in another compiler.

We can address this issue later in a minor update.

mjwen commented

Sounds good. This won't change the Python interface and we can do it later in a minor.