Hi OpenKIM folks,
I am writing a test in C++, and I am using the C++ interface to the KIM API.
In the C and Fortran interfaces, the kim pointer is passed explicitly to all API calls, but in the C++ interface the model it is an object with the API calls as methods.
What happens in the get_neigh call? Say the model is written in C or fortran, but the test is written in C++. The model calls the KIM_API_get_neigh(kimdl, …). That causes the registered get_neigh function of the test to be called. This function must have C linkage. But what it the kimdl object it gets passed (it has type void*)? Can it be safely cast to the C++ model object? I suspect not, so this function should probably use the C API rather than the C++ API? But if I have included the C++ API then the C API is not available. Is it OK to include both header files, or should I place the get_neigh function in a separate compilation unit? Or is the cast to the C++ object safe?