This project has moved. For the latest updates, please go here.

Can't load gdal_fw.dll

Topics: General Topics
Oct 5, 2006 at 1:59 PM

Is there some documentation on gdal layers and installation? I installed FWTools to C:\Program Files\FWTools1.0.5 and I confirmed gdal_fw.dll exists in the bin directory. I have also copied this file into the ASP.Net projects bin directory, rebooted, but still I get this error.

Line 28: SharpMap.Map map = new SharpMap.Map();
Line 29:
Line 30: SharpMap.Layers.GdalRasterLayer layRaster = new SharpMap.Layers.GdalRasterLayer("122811", MapDir + @"12281\122811.KAP");

[Exception: Couldn't load dataset. The type initializer for 'GDALWrapper.Gdal.GdalInterOp' threw an exception.System.DllNotFoundException: Unable to load DLL 'gdal_fw.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
at GDALWrapper.Gdal.GdalInterOp.GDALAllRegister()
at GDALWrapper.Gdal.GdalInterOp..cctor()]
SharpMap.Layers.GdalRasterLayer..ctor(String strLayerName, String imageFilename) +193
RasterMap.CreateMap() in c:\Inetpub\wwwroot\VENavAid\App_Code\RNCMap.cs:30
mapservice.ProcessRequest(HttpContext context) in c:\Inetpub\wwwroot\VENavAid\test.ashx:17
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

Oct 6, 2006 at 2:39 PM
Two things you can do to have the system find the DLL:
1. Put the directory in your PATH
2. Drop the DLL into <windows>\system32

But this won't necessarily fix your issue. The problem just might be that gdalfw.dll depends on another DLL that gdalfw.dll is not finding. In this case .NET doesn't really report the correct error. What you need to do is inspect gdal_fw.dll for its dependencies. I believe Sysinternals has a good tool for this.

Oct 12, 2006 at 5:13 PM
You can also run fuslogvw.exe in the .Net SDK, or in the SDK folder of the Visual Studio folder (if you've got it). It will log fusion's (the assembly loading subsystem) attempts to locate and load the assembly. Often much richer and more specific than filemon.exe.
Oct 13, 2006 at 8:21 AM
Apparently, you can also just turn on fusion logging with the following commands from a command line:

REG ADD HKLM\Software\Microsoft\Fusion /v ForceLog /t REG_DWORD /d 1 /f

REG ADD HKLM\Software\Microsoft\Fusion /v LogPath /t REG_SZ /d "<path\to\logfiles>" /f

...where <path\to\logfiles> is the place you'd like fusion to dump all its logs.

Of course, turn it off with:

REG ADD HKLM\Software\Microsoft\Fusion /v ForceLog /t REG_DWORD /d 0 /f
Nov 8, 2006 at 8:54 PM
I hd the same problem b4.
And I had to change this line to set the dll full path.

//old line
//public const string GdalDllName = "gdal_fw.dll";

public const string GdalDllName = @"D:\fwgdal\gdalfw.dll";