Jump to content

You're browsing the 2004-2023 VATSIM Forums archive. All content is preserved in a read-only fashion.
For the latest forum posts, please visit https://forum.vatsim.net.

Need to find something? Use the Google search below.

Get those managed C# addon's in your sim!


Gabriel Reiser
 Share

Recommended Posts

Gabriel Reiser
Posted
Posted

Hey guys,

 

I was working on a SimConnect program the other day for P3dv2 when reading through the SimConnect docs with a fine tooth comb something struck(t) me. Those that build native C++ addons will have known about this for years yet never found a way for us C# programmers to have our cake and eat it too. C# addons were always separate programs because of this. DLLStart and DLLStop exports.

 

C++ guys write addons that start and stop as FSX/P3D/FSX:SE loads them from dll.xml in your appdata dirs. PMDG's amazing 737's load dll's this way, FSUIPC loads this way. Yet C# dll's can't because the whole managed/unmanaged stuff.

 

Until now. I thought surely there's someone out there (with more knowledge of win32 programming than I have) has figure out how to export C# functions like native C++ functions.

 

Robert Giesecke did.

https://sites.google.com/site/robertgiesecke/Home/uploads/unmanagedexports

 

And he released it on NuGet.

https://www.nuget.org/packages/UnmanagedExports

 

I've already got a simconnect C# client running by using:

[DllExport("DLLStart", CallingConvention=CallingConvention.StdCall)]

and

[DllExport("DLLStop", CallingConvention=CallingConvention.StdCall)]

on some methods and put that bad boy somewhere in the P3dv2 tree, referenced it from dll.xml from my appdata dir for p3d and voila! P3dv2 asked if I wanted to load it. I said "Sure!". And there it was. Running within FSX.

 

My next task is to get the HWND of FSX itself and draw some System.Windows.Forms to it!

Link to comment
Share on other sites

Gabriel Reiser
Posted
Posted

Bah, seems I can't get the managed SimConnect library successfully loaded as well. I'll keep hacking at it.

Link to comment
Share on other sites

 Share