Gabriel Reiser Posted April 2, 2015 at 09:37 PM Posted April 2, 2015 at 09:37 PM 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 More sharing options...
Gabriel Reiser Posted April 2, 2015 at 11:43 PM Author Posted April 2, 2015 at 11:43 PM 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 More sharing options...
Recommended Posts