MATLAB: Do static variables inside a DLL not seem to work when used from a MEX-file in MATLAB

MATLAB

I have written a MEX-file that uses LOADLIBRARYfunction to load a DLL that has a static variable in it. However, each time I call the MEX-file, the static variable does not seem to retain its value.

Best Answer

Because you are loading the DLL and unloading it each time, the static variable is cleared.