[gdal-dev] Re: C#: Gdal on Win64

Tomas R monshi at home.se
Sat Mar 1 04:20:09 EST 2008


Oh, thanks for testing my plugin. Really appreciate your assistance!

The source project, the whole VSE solution, you can find here:
http://mapplugin.googlepages.com/GDALPlugin_source.zip
Excluded are ALL DLLs from FWTools, just to keep down the size. I guess 
you have those. Copy all DLL files in FWTools\bin to the folder GDALBin 
in the project and set all files to be copied to target. Probably you 
also have to set the target folder of the build to another location 
since it is set to the location of the installation of SportTracks on my 
computer.

1: Oh, my. No chance you (or who ever) moves FWTools to Net2 and  
possibly Win64 soon?  I guess it is possible for me, on a XP 32 bit, to 
compile it all to Win64 but it is unknown territory for me. 
What would I need to recompile? Just the files the C# wrapper directly 
interact with (gdal, gdalwarp, osr, ogr, gdalconst, mapscript) or all 
(!) files of the FWTools package I may need? Which I actually need of 
those - no idea.

2: Quick, dirty and may work. I will give it a try but, as you indicate, 
it is far from a perfect solution. Took some time but I finally found 
how to set this option in Visual Studio Express, this page helped me:
http://www.thescripts.com/forum/thread755379.html
Will give the Vista 64 user a version with the flag set and see if it 
works.

Yours
/Tomas

Tamas Szekeres skrev:
> Tomas,
>
> I did some tests with your files on my Win2003 x64 Server. I can see
> your assembly is actually running against the x64 version of the .NET
> framework 2.0, but the binaries in FWTools have been compiled for the
> .NET FW 1.0.
>
> Although these assemblies can work side by side in case if both of the
> framework versions are installed. Despite I have both of these
> installed I got the badimageformat exception as well. The most
> possible reason of this is that the 64 bit version of the framework
> expects to load only the x64 versions of the unmanaged dll-s (like
> gdal_wrap.dll, proj.dll).
>
> I couldn't actually check the statements above because I have no
> chance to recompile your plugin against my gdal binaries.
>
> However for supporting x64 you have at least the following 2 options:
>
> 1. Compile gdal and all of the dependencies for x64 and use these
> binaries instead of the FWTools version. You'll have to distribute 2
> versions of your package (x64 and x32) in this case.
>
> 2. Force your dll to run against the 32 bit version of the .NET
> Framework 2.0 by using the /platform:x86  csc command line option. If
> you are using the VS2005 IDE you can find this option project
> settings/Build tab/Platform target. In this case I think the FWTools
> binaries will become usable, but I recommend to compile gdal for the
> 2.0 version of the .NET framework anyway.
>
>
> Best regards,
>
> Tamas
>
>
>
> 2008/2/29, Tomas R <monshi at home.se>:
>   
>>  Sad to say, same error occured with these dlls. I renamed them to
>>  gdal_fw.dll and proj_fw.dll and also kept a copy of proj.dll with
>>  original name and told the user to overwrite the existing ones.
>>
>>  Same error.
>>
>>  I will not say it is a Vista problem, or a 64-bit problem, until I have
>>  a confirmation from someone else.
>>  If anyone here, with a 64-bit system (Vista, XP or Server 2003),  is
>>  willing to give it a try:
>>  1: Install SportTracks
>>  http://www.zonefivesoftware.com/SportTracks/
>>  2: Install my GDAL-plugin
>>  http://mapplugin.googlepages.com/gdal
>>
>>  Start SportTracks, go to the settings view. Locate the plugin and check
>>  if it is installed correctly. Version info should be displayed.
>>
>>
>>  Yours
>>  Tomas
>>
>>  Tamas Szekeres skrev:
>>  > Grrr.  I've posted a reference to the x32 builder, here are the correct ones:
>>  >
>>  > http://vbkto.dyndns.org:1080/gdal/szekerest-vc80x64-full/gdal/
>>  > http://vbkto.dyndns.org:1080/gdal/szekerest-vc80x64-bin
>>  >
>>  > Best regards,
>>  >
>>  > Tamas
>>  >
>>  >
>>  > 2008/2/29, Tomas R <monshi at home.se>:
>>  >
>>  >> Neither have I access to a computer with Vista 64, or any other 64 bit
>>  >>  system, it is a user who has reported the error. I'm waiting to see if
>>  >>  there will be another user with a 64 bit system who will test the plugin
>>  >>  so as you say, it is not yet confirmed it is a 64 bit error.
>>  >>
>>  >>
>>  >>  The plugin is compiled to .Net2.0 and, of course on Vista, run on .Net3.5.
>>  >>
>>  >>  Since I personally can't test it is a bit harder/slower to verify if it
>>  >>  works.  A quick test on my computer (Win XP, 32 bit), after renaming the
>>  >>  gdal16dev.dll to gdal_fw.dll, together with FWTools C# wrappers and
>>  >>  supporting libraries I am able to query the gdal version but not, with
>>  >>  existing code, set up a spatial reference. (Pinvoke error, Can't read
>>  >>  the DLL-file osr_wrap)
>>  >>
>>  >>  Strange - is it a 64 bit "version" of gdal? should it then at all work
>>  >>  on my 32 bit system? That it fails on setting up a spatial reference I
>>  >>  guess is because it it is not able to reference to the FWtools version
>>  >>  of the supporting dlls. Or?
>>  >>
>>  >>  I will see if the user is willing to try this dll I downloaded from your
>>  >>  link and see if he is able to retrieve version information. If that
>>  >>  works we can move on to the rest of the libraries if you are willing.
>>  >>
>>  >>
>>  >>  Yours
>>  >>  Tomas
>>  >>
>>  >>  Tamas Szekeres skrev:
>>  >>
>>  >>
>>  >>> Tomas,
>>  >>>
>>  >>  >
>>  >>  > Currently I have no opportunity to test on Vista 64 at the moment and
>>  >>  > therefore I cannot decide whether this is a Vista specific issue or
>>  >>  > not. I'm not sure which .NET framework you are running against. You
>>  >>  > might want to do a test with my Windows Server 2003 x64 compilation
>>  >>  > can be downloaded from the buildbot:
>>  >>  >
>>  >>  > http://vbkto.dyndns.org:1080/gdal/szekerest-vc80-full/gdal/
>>  >>  >
>>  >>  > I could also make the x64 versions of related dlls like proj.dll
>>  >>  > available to download.
>>  >>  >
>>  >>  > Best regards,
>>  >>  >
>>  >>  > Tamas
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>
>>  >>
>>  >>> 2008/2/29, Tomas R :
>>  >>>
>>  >>  >> Is it possible to use gdal (C# wrapped)  from FWTools on a Win64 system
>>  >>  >>  (Vista 64)?
>>  >>  >>
>>  >>  >>  I have a plugin for SportTracks which gives other libraries access to
>>  >>  >>  GDAL. This is achieved by adding the path to the GDAL binaries to system
>>  >>  >>  PATH (for the running program).
>>  >>  >>
>>  >>  >>  On a Win64, i.e. Vista 64, the exception below is thrown when trying to
>>  >>  >>  read the version of the GDAL libraries. Is this normal behaviour or is
>>  >>  >>  there anything I can do to avoid this exception? I use GDAL 1.6.0dev
>>  >>  >>  from FWTools 2.1.0. All supportive libraries from FWTools are available
>>  >>  >>  to Gdal.
>>  >>  >>
>>  >>  >>  System.TypeInitializationException: The type initializer for
>>  >>  >>  'OSGeo.GDAL.GdalPINVOKE' threw an exception. --->
>>  >>  >>  System.TypeInitializationException: The type initializer for
>>  >>  >>  'SWIGExceptionHelper' threw an exception. --->
>>  >>  >>  System.BadImageFormatException: An attempt was made to load a program
>>  >>  >>  with an incorrect format. (Exception from HRESULT: 0x8007000B)
>>  >>  >>    at
>>  >>  >>  OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_Gdal(ExceptionDelegate
>>  >>  >>  applicationDelegate, ExceptionDelegate arithmeticDelegate,
>>  >>  >>  ExceptionDelegate divideByZeroDelegate, ExceptionDelegate
>>  >>  >>  indexOutOfRangeDelegate, ExceptionDelegate invalidOperationDelegate,
>>  >>  >>  ExceptionDelegate ioDelegate, ExceptionDelegate nullReferenceDelegate,
>>  >>  >>  ExceptionDelegate outOfMemoryDelegate, ExceptionDelegate
>>  >>  >>  overflowDelegate, ExceptionDelegate systemExceptionDelegate)
>>  >>  >>    at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper..cctor()
>>  >>  >>    --- End of inner exception stack trace ---
>>  >>  >>    at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper..ctor()
>>  >>  >>    at OSGeo.GDAL.GdalPINVOKE..cctor()
>>  >>  >>    --- End of inner exception stack trace ---
>>  >>  >>    at OSGeo.GDAL.GdalPINVOKE.SetConfigOption(String jarg1, String jarg2)
>>  >>  >>    at OSGeo.GDAL.Gdal.SetConfigOption(String arg0, String arg1)
>>  >>  >>    at GDALPlugin.Gdal_Interface..ctor()
>>  >>  >>
>>  >>  >>
>>  >>  >>  Yours
>>  >>  >>  Tomas
>>  >>  >>
>>  >>  >>  _______________________________________________
>>  >>  >>  gdal-dev mailing list
>>  >>  >>  gdal-dev at lists.osgeo.org
>>  >>  >>  http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>  >>  >>
>>  >>  >>
>>  >>
>>  >>
>>  >>  _______________________________________________
>>  >>  gdal-dev mailing list
>>  >>  gdal-dev at lists.osgeo.org
>>  >>  http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>  >>
>>  >>
>>
>>  _______________________________________________
>>  gdal-dev mailing list
>>  gdal-dev at lists.osgeo.org
>>  http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>>     



More information about the gdal-dev mailing list