[Gdal-dev] problem with C# SWIG wrapper

Mateusz Loskot mateusz at loskot.net
Sat Mar 3 06:36:23 EST 2007


Richard Matsunaga wrote:
> Hi all,
> 
> I've just started using the SWIG-generated C# wrapper and can't get
> it to work. The build seems to run fine, as do the tests, but when
> actually trying to use the resulting library, I get the following:
> 
> System.TypeInitializationException : The type initializer for 
> 'GDAL.gdalconst' threw an exception. ---->
> System.TypeInitializationException : The type initializer for 
> 'GDAL.gdalconstPINVOKE' threw an exception. ---->
> System.TypeInitializationException : The type initializer for 
> 'SWIGExceptionHelper' threw an exception. ---->
> System.DllNotFoundException : Unable to load DLL 
> 'gdal_gdalconst_wrap': The specified module could not be found.
> (Exception from HRESULT: 0x8007007E)
> 
> I get the same error (without the extended info) when I try to run
> the GDALColorTable.exe that gets created with the build.
> 
> Is there some config that I must have missed? I think there is a need
> for a single wiki page for documenting the setup for using the C#
> wrappers along with common pitfalls.

Richard,

I've managed to make GDAL with C# bindings working:

http://mateusz.loskot.net/tmp/gdal-csharp-works.png

So, I can confirm current version of GDAL from SVN and C# interfaces
does work.

In my case, the problem was that some of DLL dependencies were not in
PATH while I was executing C# version of ogrinfo.exe or createdata.exe.

What Tamas already suggested, please could you check if all libraries
used by your compilation of GDAL are available in PATH?
In my case, I didn't have GEOS DLL in PATH, so please walk through
dependencies like MySQL, PostgreSQL, GEOS, etc. (if built in to your
GDAL) and see if they are reachable.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list