View Issue Details

IDProjectCategoryView StatusLast Update
0026801FPCCompilerpublic2014-09-30 10:30
ReporterBigChimpAssigned ToJonas Maebe 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionnot fixable 
Platformx64 (with x86 compiler)OSWindowsOS VersionWindows 7
Product Version2.7.1Product Build28723 
Target VersionFixed in Version 
Summary0026801: Library initialization support for database applications
DescriptionCurrently, instantiating a class that sets up an sqldb Firebird connection in the initialization section of a unit leads to access violations. (Similar code works in a regular program, not a library)

Moving the instantiation out of the initialization section does work.

I understand initialization order is not defined but it would be nice if support were available for this.
Steps To ReproduceSee attached example.
Requirements: any Firebird server (or presumably embedded db though untested)

Steps:
1. Please update your Firebird server details in dbinterface.pas to your
situation (hostname etc)
2. In businesslayer.pas, $define CRASH to see the problem.
3. Compile library and test program and run.
Additional InformationFurther points/discussion:
José Mejuto:
http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg37746.html

Mark Morgan Lloyd:
http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg37752.html
Tagsdll, library
Fixed in Revision
FPCOldBugId0
FPCTarget
Attached Files

Activities

Reinier Olislagers

2014-09-30 08:29

developer  

dllcrash.zip (3,275 bytes)

Jonas Maebe

2014-09-30 10:08

manager   ~0077806

From 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.

Issue History

Date Modified Username Field Change
2014-09-30 08:29 Reinier Olislagers New Issue
2014-09-30 08:29 Reinier Olislagers File Added: dllcrash.zip
2014-09-30 08:35 Reinier Olislagers Tag Attached: dll
2014-09-30 08:35 Reinier Olislagers Tag Attached: library
2014-09-30 10:08 Jonas Maebe Note Added: 0077806
2014-09-30 10:08 Jonas Maebe Status new => resolved
2014-09-30 10:08 Jonas Maebe Resolution open => not fixable
2014-09-30 10:08 Jonas Maebe Assigned To => Jonas Maebe
2014-09-30 10:30 Reinier Olislagers Status resolved => closed