[fpc-pascal] Reproducible code: DLL calling Firebird crashes
Michael Van Canneyt
michael at freepascal.org
Tue Sep 30 13:19:10 CEST 2014
On Tue, 30 Sep 2014, Mark Morgan Lloyd wrote:
> Reinier Olislagers wrote:
>> On 29/09/2014 19:30, Reinier Olislagers wrote:
>>> Re bug report: agreed. I'll raise it.
>
> Jonas has already closed it, noting
>
> "http://msdn.microsoft.com/en-us/library/windows/desktop/ms682583%28v=vs.85%29.aspx
>
> "***
> The entry-point function should perform only simple initialization or
> termination tasks. It must not call the LoadLibrary or LoadLibraryEx function
> (or a function that calls these functions), because this may create
> dependency loops in the DLL load order. This can result in a DLL being used
> before the system has executed its initialization code.
> ***
>
> "I.e., what you are doing is unsupported ("must not call the LoadLibrary or
> LoadLibraryEx function"). I think that on most unix platforms, trying to load
> libraries from other the init function of other libraries is not supported
> either."
>
> However I'd precede that by a thought based on what Jose said. In your
> example, you're opening the database in the initialisation block of
> businesslayer.pas, which is invoked at an arbitrary position in the init
> sequence of the DLL/so. If that operation were moved instead to the
> initialisation block of testdbdll.lpr, which in the context of the DLL/so is
> analogous to a program's main block, it might work.
No. this is not correct. For a library, this is analogous to initialization code of a unit, it's just the 'last' unit being initialized.
Michael.
More information about the fpc-pascal
mailing list