Lazarus
Programming => General => Topic started by: julkas on July 04, 2020, 06:10:21 pm
-
Is it safe call LoadLibrary() from unit initialization section?
Thanks.
-
Yes, in fact its most likely the best place since that gets called before any of the code does in the units.
Those sections get called first before the first line of your main file gets executed.
-
It is if your application is an executable, not dynamic loadable library. Windows OS will add some restrictions on this : https://docs.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-best-practices
Under Unix OS (at least Linux), it seems that you can use it as you fit without any restrictions.
-
Thanks.