System.Threading unit causes Access Violation in plugin module

I’ve been using Hydra with several different versions of Delphi over the years and have several applications with plugins in production. I was building a new one today in a similar fashion to several others I have and had need to upload a file to Amazon S3 so placed the AmazonConnectionInfo component on a data module in one of the plugin projects. As soon as the host application tried to load the module, it raised an Access Violation (and several subsequent errors) forcing me to kill it.

After about an hour of double-checking everything and tracing used units, I discovered that simply including the System.Threading unit anywhere in the plugin module project caused the error. The host application loaded another plugin (without System.Threading) and ran just fine. But even when I removed all units but a few simple classes so that the plugin module did absolutely nothing, that threading unit still caused the problem when Hydra tried to load the module.

Looking into System.Threading, its initialization section simply registers a DLLShutdownProc but this error occurs when the DLL is being loaded by Hydra, before the application has a chance to do anything else.

I have the latest versions of everything: Delphi 10.3 Update 2 and Hydra Both the host and plugins are Delphi VCL 32-bit.

Any suggestions?


this is known issue - if plugin contains reference to System.Threading, this plugin cannot be unloaded and loaded again

workaround - use LoadVCLModule instead of LoadModule - in this case it doesn’t try to detect module type and just loads it.

Thanks–I was not aware of that. It’s working now but if I have need to add .NET plugins, I’ll have to find a workaround to this workaround!