Shared sections in a DLL
-
Hi, I am writing a DLL in which certain data have to be shared between all processes, and all threads accessing this DLL. This is put in a Shared section in the DLL. Do the sync objects such as CRITICAL_SECTION, MUTEX, etc. still work as expected? or are there caveats to be weary of. It is something that is very difficult so test or simulate! Regards,
Bram van Kampen
-
Hi, I am writing a DLL in which certain data have to be shared between all processes, and all threads accessing this DLL. This is put in a Shared section in the DLL. Do the sync objects such as CRITICAL_SECTION, MUTEX, etc. still work as expected? or are there caveats to be weary of. It is something that is very difficult so test or simulate! Regards,
Bram van Kampen
Quote:
CRITICAL_SECTION, MUTEX, etc. still work as expected?
Normally, they do test before releasing the libraries and SDKs, but it still depends on which runtime and its version are you using, as well as what is the deployment OS. Did you check the documentation? [About Synchronization | Microsoft Docs](https://docs.microsoft.com/en-us/windows/desktop/sync/about-synchronization). Also, please read this reference of synchronization to get to know a bit more about these topics, mutex, critical sections, etc. [Synchronization Functions | Microsoft Docs](https://docs.microsoft.com/en-us/windows/desktop/sync/synchronization-functions), there are remarks for each function and the type, you can review them. For example, here is the documentation and remarks for the function call that enables the program to enter the critical section, [EnterCriticalSection function | Microsoft Docs](https://docs.microsoft.com/en-gb/windows/desktop/api/synchapi/nf-synchapi-entercriticalsection)
The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~
-
Hi, I am writing a DLL in which certain data have to be shared between all processes, and all threads accessing this DLL. This is put in a Shared section in the DLL. Do the sync objects such as CRITICAL_SECTION, MUTEX, etc. still work as expected? or are there caveats to be weary of. It is something that is very difficult so test or simulate! Regards,
Bram van Kampen
Place POD data to Dll shared section. Use named objects (mutex, event) to synchronize this shared data. Named synchronization objects should not be placed to the shared section. Interprocess Synchronization | Microsoft Docs[^]