I use a Perl module built with Swig, which implements the interface with a dynamic library coded in C++.
I need to use this module with different versions of the C++ library, so what I do is: set the PATH environment variable according to the desired library version, use exec so that this environment variable is taken into account (it doesn't work otherwise), then require the module generated by Swig