Jump to content
The simFlight Network Forums

Using SimConnect.dll and FSUIPC WAPID.dll in the same project


Norbyx

Recommended Posts

I've been trying to use both the SimConnect.dll and the WAPID.dll in the same project in Visual Studio C# but I always get an error message and the code won't compile. (System.BadImageFormatException   HRESULT: 0x8007000B).

Though I've been successful in running both dll's individually, but not both in the same project. I've tried to change the target platform from x64 to x86 to AnyCPU but either the SimConnect or the WAPID gives back an error.

I'm no professional programmer, nor do I know alot about programming, so I'd be thankful if someone could help me figure out how to fix this issue!! 

Link to comment
Share on other sites

Do you mean Microsoft.FlightSimulator.SimConnect.dll and FSUIPC_WAPID.DLL?

Assuming you do:

FSUIPC_WAPID.DLL is 64 bit only. So your application must run as a 64-bit process. The best way to do this is to set it to target x64 only. Not Any CPU.

FSUIPC_WAPID.DLL is not a managed (.net) library. Therefore it cannot be linked into your application at compile time. It is only loaded at runtime. So this DLL can not prevent the application from compiling. If the architecture is wrong (e.g. your application is running at 32-bit) then you will get an error at runtime, not compile time. I surprised you're saying this is causing a compile problem.

Microsoft.FlightSimulator.SimConnect.dll that comes with FSX is compiled to target 'Any CPU'. I don't have MSFS but the managed simconnect libraries for MSFS must be either 'Any CPU' or 'x64'. Therefore they should run ok in an x64 application.

Are you using any other third-party dlls or Nuget packages? Maybe one of those is causing the issue.

I suggest making a new blank project targeting x64 and adding in the libraries you need one by one. After adding each one, make sure it compiles and that you can still open the WAPID.dll connection. This might narrow down the problem for you.

Paul 

 

 

Link to comment
Share on other sites

  • 3 weeks later...
4 hours ago, Intood said:

What is SimConnect.dll?

Microsoft.FlightSimulator.SimConnect.dl is a library supplied by the authors of the Flight Sim to enable .NET languages to interface with SimConnect directly. SimConnect is an API for reading and writing data to/from the Flight Sim. It was written to do the same job as FSUIPC. FSUIP4 and above uses SimConnect in the background. 

4 hours ago, Intood said:

What is FSUIPC WAPID.dll?

It's a library to enable programs written in any language to talk to John Dowson's WASM module for MSFS (2020). The WASM module allows the client program to read/write LVar and HVar variables from aircraft that use them. My FSUIPCClientDLL for ,NET uses this in the background for the MSFSVariableServices feature.

4 hours ago, Intood said:

Why would you use both of these in the same project?

You would use SimConnect if you didn't want to use FSUIPC. 

You would use FSUIPC_WAPID.dll if you want access to John's WASM module and you are not using my FSUIPCClientDLL for .NET.

4 hours ago, Intood said:

How do you install both of these in the same project?

SimConnect is installed in the normal way you add any .NET library through Visual Studio - PROJECT-> Add Reference. You must have installed the Flight Sim sdk to get the SimConnect dll installed on your computer.

The WASM dll is not a .NET dll, so this is just copied into the project and loaded at runtime with the [DLLImport] tag. You must also declare copies of each of the functions in the DLL that you want to access.

 

In summary if you're using .NET just use my ClientDLL and everything is taken care of for you. You won't need to worry about either of these DLLs. Use of both of these DLLs requires advanced knowledge of programming.

Paul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.