Calling Simconnect.dll from within a DLL

Hi guys, I am trying to build a DLL that could be used by different clients.
This DLL should call functions defined in Simconnect.dll. Until now I cannot
get this working. If I call my functions directly in a exe, everything goes
fine, no problem. However, as soon as I externalize the calls in a DLL I keep
getting SIMCONNECT_EXCEPTION. and more specifically, I get the following one:
SIMCONNECT_EXCEPTION_ERROR which is not really documented and thus not very
helpful. So my question is: Is it possible to have a DLL call Simconnect.DLL ?
Are there some compiling options one need to set ? Thanks for any pointers or
hints. Cheers, -S.

C++ or C#?

Definitively. In fact, I have a „plugin architecture“ (DLLs that are loaded / unloaded at runtime, by the application itself).

And my „MSFS“ plugin (DLL) links with the SimConnect.dll and works like a charm.

I don‘t set any specific linker options myself (the used C++ toolit Qt does it all for me, respectively Cmake).

You may want to have a look:

Specifically the plugin:

And the SimConnect server (here: MSFS) simply gets the request data via a „pipe“ (by default), that is „all it sees is data“. And that data is either correct or not - but regardless of whether it is initiaded via „exe/SimConnect.dll“ or via another DLL „in between“: „exe/Your.dll/SimConnect.dll“

Perhaps in „Your.dll“ you are using static objects that are not initialised (on the heap) at the right time?

And the whole question should be language agnostic as well: C++, C#… doesn‘t matter, from a server point of view. Again, all it sees „is data“.

So the usual suspects apply:

  • Make sure you properly connect wirh MSFS
  • Make sure that all your request data is properly setup (don‘t forget to „pack“ records!)
  • And check all returned error codes