Crash when repeatedly load/free a dll which calling mkl ?potrf function
We need to use LoadLibrary() and FreeLibrary() to dynamically load/unload a dll, which, among other things, calling mkl ?potrf() function. But the calling often ends up with a crash in a few (2 or 3) cycles.
This problem is isolated into a tiny demo code attached below. The testDll.f90 is the code for the dll; and client.f90 does the loading, calling and freeing which is based on the dll sample code coming with the compiler.
This crash can also be duplicated by calling from C code.
Did I miss any critical initialisation and/or clean up function from the code?
The code was built using Intel(R) Visual Fortran Compiler for IA-32, Version 22.214.171.124.