I am wondering how to handle following problem:
I have a C-language library that performs calculations on a mesh, but cannot be called several times (i.e. is not reentrant). I have the source code, and I am wondering how to "wrap" that library so as to be able to instanciate it several times.
I see two options:
1. Write a wrapper in C++. The problem with this approach is that I would have to heavily modify the C library. Knowing that the C library itself will evolve independently, I would have to constantly adapt my wrapper.
2. Not sure if this is possible, but somehow load the library into memory several time. E.g., if that library is compiled as a shared library, my application could dynamically load and use its exported functions. Is there a way or mode that allows to load a same shared library into several different memory locations?
Would there be another option?
Thanks for any insight!