How connect exe to .dll to get Panels pointer

This is my first post-any help would be appreciated. I am running P3DV4 and am using external C++ application that accesses sim vars via simConnect to publish them for other apps. My exe runs in an environment I do not control. This pattern worked well until a new AC model was introduced that uses custom XML gauges. Several sim variables have been replaced with L:vars and I am having trouble getting to them. I have searched web and forum. I have run Cabin Comfort. I first attempted to use gauges.h in my exe, then per forum advice modified gauges.h to use Panels instead of ImportTable (for example Panels->execute_calculator_code). I understood that the Panels pointer would be populated by simConnect, but since running .exe it wasn’t. So now using forum advice to create a .dll (module, update dll.xml) that will populate the pointer and hoping to use this pointer in my exe to get the L:var data. I know the dll has to live in P3D root (or per Ed, in root/Modules folder). But, in order for my exe to use the .dll it needs it in its (the .exe’s) folder. I researched accessing .dll from different locations but there are many warnings not to do this. I don’t know how to connect my .dll in P3D to my .exe. How do I get to the Panels pointer? My dll is not using simConnect. If this is wrong approach, suggestions appreciated.
You can load execute_calculator_code dinamically (LoadLibrary and GetProcAddress) from the panels.dll, in your module dll.
Then you can retrieve your variables and share them with your exe.


Resource contributor
If I understand correctly, you want to call panel.dll functions from your exe? If so, it is not possible to do that with an external process. You can read and write data between processes using Read/WriteProcessMemory but you can’t call functions directly across process. What you can do is call the panels.dll functions from your dll and store the data in a simconnect client data structure and access that from your exe.
Thank you both. Yes I was trying to access the functions from my .exe – I will not waste any more time trying to get the panels pointer to my .exe. If I understand correctly, I should retrieve all the L:var data in my module (.dll) then, I can retrieve the data in my .exe in one of two ways: use getters to access the external data, or using a “simconnect client data structure” to access the data. I’m not sure about the simconnect data structure, but will look into it. If I am not understanding, please correct me.
So, I'm stuck. I have a .dll that is loaded by P3d. I have a non-null Panels pointer. I am trying to get to a custom variable that was created by a 3rd party. I am not getting a valid ID on the variable name when I execute check_named_variable.
The custom model is defined in My Documents\Prepar3D v4 Add-ons
I have verified that the variable of concern is in the Add-ons folder in a few .xml files. For ease I am giving an example of my call using another variable in those .xml files.
ID myId = check_named_variable("L:paused");

This call always returns an ID of -1 (not found). Since the variable is already in the model, I did not think I had to register it. Any idea what I am doing wrong?

Caveat -- I am cheating at the moment for the timing of check_named_variables. I am just using a timer to check the variable once/sec. I realize that the variable will not be available until the custom AC is loaded, but the ID never changes from -1.

I do not know if I should have started a new thread for this question - advice appreciated.
P.S. nice signature.


Resource contributor
Yeah, it's unfortunate that the smilies hijack some of the useful bits of "code" we like to post. I just noticed the new "Inline" option. I've never tried that before, so I wonder ("L:paused"); if it will work?

Yes! It does work... :cool: