Skip to content

C# Binding Errors on Windows 64bit

Hello,

first of all I do want to thank you for writing this nice project/library. I could not use it yet, but it seems to provide access to almost everything important. Currently I am trying to get it working on a Windows machine (64 bit).

What I achieved:

  • Sucessful build of libgphoto2 via MinGW64 (resulted in two libs: libgphoto2-6.dll & libgphoto2_port-12.dll)
  • Successful build of SimpleCapture (there were some project reference errors at first)

I added both dll-Files to the libgphoto2 project and changed to "copy if newer". This redundant manual copy of those needed files. To use the library I also added three dependencies (not sure why they are used, DependencyWalker told me so): libexif-12.dll, libintl-8.dll and libltdl-7.dll.

Now everything is in the final bin folder: image

My problem: When I try to start SimpleCapture the binding fails. The file seems to be found, but I guess due to the 32/64bit mismatch I get a System.BadFormatException at libgphoto2.GPhoto2.gp_context_new(): image The gp_context_new() is one of the first calls to the dll.

How this could be solved: There is already a library (a bit old), which proposes three workarounds for this mismatch (if it is one): https://github.com/gphoto/libgphoto2-sharp I did not try one of those workarounds so far.

Within issue #9 you wrote that you have compiled a libgphoto2.dll via cygwin. I can test this as well if you want and find out if it has the same behavior.

Maybe we could figure out how to solve this problem.