Lazarus

Programming => General => Topic started by: julkas on July 04, 2020, 06:10:21 pm

Title: [CLOSED] LoadLibrary() in initialization section
Post by: julkas on July 04, 2020, 06:10:21 pm
Is it safe call LoadLibrary() from unit initialization section?
Thanks.
Title: Re: LoadLibrary() in initialization section
Post by: jamie on July 04, 2020, 10:16:07 pm
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.
Title: Re: LoadLibrary() in initialization section
Post by: Cyrax on July 05, 2020, 11:00:36 am
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.
Title: Re: LoadLibrary() in initialization section
Post by: julkas on July 05, 2020, 06:55:00 pm
Thanks.
TinyPortal © 2005-2018