Bad IL Format
Bad IL Format
I am trying to create a C# WPF .NET Core 8 application that will load the RP1210 dlls dynamically. When using Assembly.LoadFrom(path), I get this error. Bad IL format. The format of the file 'C:\Windows\System32\PEAKRP32.dll' is invalid. I've seen two things, that I may have to run the application in x86 or x64, but neither this nor using the dll in the SysWOW64 directory changes this. I've seen that it may also be due to trying to use a .NET framework compiled DLL in a .NET Core project will not work. Is what I'm attempting to do possible or am I just doing something wrong? There doesn't appear to be any C# documentation for your RP1210 dll unlike everything else.
Re: Bad IL Format
Hello,
the error you get is right. Note that te PCAN-RP1210 is a native, in C++ written, Windows library. It is not an assembly. If you want to use this in an .NET environment, then you need to create a wrapper for it (keyword: marshaling). The norm specifies the header file for C/C++ within the RP1210 documentation. We also offer this header file in the RP1210 package. You can download this package using this link.
In summary, you need to "port" the C/C++ heder file into a C# header file for using it in .NET projects.
Hope to have helped you.
the error you get is right. Note that te PCAN-RP1210 is a native, in C++ written, Windows library. It is not an assembly. If you want to use this in an .NET environment, then you need to create a wrapper for it (keyword: marshaling). The norm specifies the header file for C/C++ within the RP1210 documentation. We also offer this header file in the RP1210 package. You can download this package using this link.
In summary, you need to "port" the C/C++ heder file into a C# header file for using it in .NET projects.
Hope to have helped you.
Best regards,
Keneth
Keneth
Re: Bad IL Format
Thank you for your response.