If I have a DLL with module variables, is it safe to call functions that use those variables in a parallel process? I want to avoid passing the debug level and output file to all of my functions in a DLL. So instead, my first function call into the DLL initializes 2 private module variables in the module logging: output_file and debug_level. Then I define a subroutine write_to_log( message ). In a non-parallel application, from anywhere in the dll I can say "use logging" and simply write "call write_to_log( some_message )." If I have multiple threads using this library, will all my logging messages go to the output file initialized by the last logging initialization call? My understanding is that they will not, but they would if I declared the variables in a common block. Is this correct?
If this question has been asked before and I missed it, or if there are any references out there please point me in that direction. Thanks for your time!