Opened 17 years ago
Closed 17 years ago
#251 closed defect (fixed)
Visual C++ 2005 runtime error when attempting to create connection
Reported by: | jng | Owned by: | traianstanev |
---|---|---|---|
Priority: | major | Milestone: | 3.3.0 |
Component: | OGR Provider | Version: | 3.3.0 |
Severity: | 3 | Keywords: | ogr runtime error |
Cc: | External ID: |
Description
I get a Visual C++ 2005 runtime error when attempting to call IConnectionManager::CreateConnection() with the OGR provider.
The error message I get is:
Microsoft Visual C++ Runtime Library
Runtime Error! Program: [path to executable] R6034 An Application has made an attempt to load the C runtime library incorrectly. Please contact the application's support team for more information.
If I run this through the vs debugger, I get an unhandled OSGeo.FDO.Common.Exception with the following message.
"Unable to load the FDO Provider: A dynamic link library (DLL) initialization routine failed."
I've tried the calls in both C# and C++, and both trigger the same error.
The relevant pieces of code are:
C#:
IConnectionManager connMgr = FeatureAccessManager.GetConnectionManager(); IConnection conn = connMgr.CreateConnection("OSGeo.OGR.3.3");
C++:
FdoPtr<IConnectionManager> connMgr = FdoFeatureAccessManager::GetConnectionManager(); FdoPtr<FdoIConnection> conn = connMgr->CreateConnection(_T("OSGeo.OGR.3.3"));
Both fragments never get past CreateConnection()
I was using FDO 3.3.0 RC1 (from binary sdk and source) with the VC++ 2005 SP1 runtime installed.
Change History (3)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
Priority: | critical → major |
---|---|
Severity: | 1 → 3 |
Running this same code on a fresh windows xp virtual machine (installing the vc runtime beforehand), I get errors of being unable to find msvcp80.dll (one of the runtime dlls) even though I already installed the redistributable package.
Copying the runtime dlls in question to the output directory gives me the same R6034 error.
Investigating the R6034 error further, I rebuilt the OGR provider with a statically linked runtime library (/MT) and now both code fragments run.
But now I get a R6025 pure virtual function call error when attempting to do anything further with the provider, probably as a result of the static linkage.
Anyway, now I believe that it is nothing to do with FDO, but rather with the VC++ 2005 SP1 Runtime Library.
comment:3 by , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Solved it! The release configuration for the OGR Provider vcproj did not generate or embed the manifest.
Building the OGR Provider in release mode with manifest generation and embedding enabled resolved this problem.
I must also stress that it is only occuring with the OGR provider. If I use any other provider string (eg. OSGeo.SDF.3.3, OSGeo.SHP.3.3, etc) they work fine.