[Gdal-dev] C# Bindings

Tamas Szekeres szekerest at gmail.com
Thu Nov 2 18:39:09 EST 2006

> The lines I added to the makefile check to see if the manifest file
> exists before embedding it in the DLL, so AFAIK they would have no
> effect on VS 2003. Would it have any effect on MONO builds?

It seems to be working with the MONO framework as well. In this regard
I have no objection to embed the manifests into the corresponding
dll-s using the mt tool after checking the existence of the manifest
files. If you have already modified the makefile.vc accordingly then
go ahead and commit the changes.

> > So as to speed up this work if would be helpful if I got some expected
> > C# examples to see how the folks would use the interface. Some of the
> > specific test samples could be placed into the \swig\csharp\apps
> > directory as well.
> I'd be happy to help with this, since I need this one function ASAP -
> ideally by the weekend... I'll take a look tonight and if I come up with
> an obvious solution I'll run it by you. I'm not a SWIG expert by any
> means, though I did write large chunks of the hand-rolled C# GDAL
> bindings that were circulated on this list a few months back, including
> this function.
> Just off the type of my head, it would be nicest to have a generic
> function with a signature that was something like:
>   CPLErr ReadRaster<T>(int xOff, int yOff, int xSize, int ySize, T[]
>   buffer, int bufXSize, int bufYSize, int pixelSpace, int lineSpace)
> and similarly for Band.WriteRaster(). Overloads could be provided
> without the last two arguments (or even the last four), for the most
> common default cases. Is this kind of generic function possible with
> SWIG? Or are you trying to preserve C# 1.x compatibility anyway (which
> would preclude using generics)? Without the generic, we could either
> have separate functions for each of the GDAL data types (my preference)
> or have the user pass in some kind of void pointer and a type flag as in
> the C function. What do you think?
> Actually, it may even be better to have the user pass in a pointer since
> we often want to use GDAL to read/write from/to a Bitmap buffer, where
> we can only access the internal buffer via a pointer. Either way, the
> function is likely to have to be declared unsafe.

Since I would support VS2003 with FW 1.x and MONO the template
approach is not realistic so far. Instead I would support overloading
the functions with the generic data types. It will be mostly a C#
interface specific solution. I will take care of it as soon as

Best Regards,

Tamas Szekeres

More information about the Gdal-dev mailing list