You are not logged in.
Pages: 1
Hi,
I have the following problem, my application is multithread and each thread load/unload a DLL. This DLL use a TWinHTTP.Post that call an interface based service on the server side. Every so often the error "Custom variant type ($0111) already used by TDocVariant" is raised, I suspect this is because when a DLL in a thread is unloading, another (with another thread) is loading and the conflict may arise in SynCommons.pas.TDocVariantData.Init.
I solved this keeping the DLL in memory.
Best regards.
Esteban
Offline
I know but the DLL are as plugins, extending specific functionality for customers.
I just commented the situation. I am having another problem with mORMot but I will put in another thread.
Thanks.
Esteban
Offline
The issue comes from the fact that SynCommons is initialized twice, once in the main exe, and another time in the dll.
AFAIR packages do not suffer for this, and unit initialization part is not executed twice when a package is loaded.
In all cases, loading dll in sub threads is pretty dangerous...
At least, I may use a critical section to protect the loading process, or use a dedicated thread.
Offline
Pages: 1