0

There is a project from Github https://github.com/versex799/FanucFocasTutorial which is qritten on c# .NET framework 4.7.1. Works ok. Trying to make the same on .NET 6.0 I get an error "System.BadImageFormatException: "An attempt was made to load a program with an incorrect format. (0x8007000B)" This error occurs when the program calls method Focas1.cnc_allclibhndl3("192.168.0.1", 8193, 6, out _handle); This method is described in fwlib32.cs .

It seems that some code in the fwlib32.dll which is calles by fwlib32.cs isn't supported or some sintaxis of fwlib32.cs is old for .NET 6.0 though there are no visible errors.

  • 1
    It seems that you call a function from a dynamic library that doesn't match your program's bitness. – jtxkopt Jun 10 '23 at 10:35
  • no, there is also 64bit DLL named fwlib64.dll and a corresonding cs file fwlib64.cs, I tried using them instead and there was the same error. – Sergei Beliakov Jun 10 '23 at 11:14
  • sorry for wrong comment above, yes I changed to 32-bit application and it works! But why it wasn't working with x64 DLL before? – Sergei Beliakov Jun 10 '23 at 11:19
  • This is how your CPU and OS work. You cannot load 64-bit DLL into a process in 32-bit context. Bitness must match. You usually have two version of the same library compiled for different architecture and also two version of your application that calls the library. You disribute them separately. Diiferent distro for 32-bit, another distro for 64-bit. – jtxkopt Jun 10 '23 at 15:38

0 Answers0