[gdal-dev] problem getting ogr_csharp to work

niels hoffmann nielslcr at gmail.com
Sun Feb 17 20:54:27 EST 2008


 Hi,

I have a problem getting the csharp binding to work.
I installed the latest FWTools 2.1.0 and I tried to explicitly add my
FWTools \bin dir to my path using the code snippet in the Q&A:
http://trac.osgeo.org/gdal/wiki/GdalOgrCsharpUsage

I'm basically following the OGRGEOS.cs example:
Geometry g1 = Geometry.CreateFromWkt("POLYGON((0 0, 10 10, 10 0, 0 0))");

But I keep getting the following exception:

Unhandled Exception: System.TypeInitializationException: The type
initializer fo
r 'OSGeo.OGR.OgrPINVOKE' threw an exception. --->
System.TypeInitializationExcep
tion: The type initializer for 'SWIGExceptionHelper' threw an exception.
---> Sy
stem.DllNotFoundException: *Unable to load DLL 'ogr_wrap'*: The operating
system c
annot run . (Exception from HRESULT: 0x800700B6)
   at
OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Og
r(ExceptionDelegate applicationDelegate, ExceptionDelegate
arithmeticDelegate, E
xceptionDelegate divideByZeroDelegate, ExceptionDelegate
indexOutOfRangeDelegate
, ExceptionDelegate invalidOperationDelegate, ExceptionDelegate ioDelegate,
Exce
ptionDelegate nullReferenceDelegate, ExceptionDelegate outOfMemoryDelegate,
Exce
ptionDelegate overflowDelegate, ExceptionDelegate systemExceptionDelegate)
   at OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..cctor()
   --- End of inner exception stack trace ---
   at OSGeo.OGR.OgrPINVOKE.SWIGExceptionHelper..ctor()
   at OSGeo.OGR.OgrPINVOKE..cctor()
   --- End of inner exception stack trace ---
   at OSGeo.OGR.OgrPINVOKE.new_Geometry(Int32 jarg1, String jarg2, Int32
jarg3,
IntPtr jarg4, String jarg5)
   at OSGeo.OGR.Geometry..ctor(wkbGeometryType type, String wkt, Int32 wkb,
IntP
tr wkb_buf, String gml)
   at OSGeo.OGR.Geometry.CreateFromWkt(String wkt)
   at pgIntersectOGRGEOS.Program.Main(String[] args) in
D:\SVN_Work\trunk\Code\p
gIntersectOGRGEOS\pgIntersectOGRGEOS\Program.cs:line 23

Anybody got any ideas?

Cheers,
Niels Hoffmann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080218/40822c6d/attachment.html


More information about the gdal-dev mailing list