• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

How to debug a DLL in P3D V4?

Messages
20
Country
belgium
Hi all

I got some code a few months back to interface my self-made hardware with p3d. It is written in c++ and creates a DLL. I have added a few more buttons and switches and they all work except for one.
The person which created this is no longer reachable unfortunately. I do have some basic c programming background but am a bit lost in how to debug it.
The code features a built-in logger using speedlog, but I dont know how to use it.

If I understand correctly, the DLL is called by SimConnect. The DLL itself is compiled in the project folder and then copied to the addons folder of p3d. Once complete it loads in the sim.
I thought I could debug by just copying the .pdb file to the same addons folder where the DLL is located, then attaching prepar3d.exe to the debugger and look when the breakpoint is hit, but this does not work.

Can anyone shed a light on this to make it more clear? Thanks!
 

DragonflightDesign

Resource contributor
Messages
892
Country
northernireland
I think you are pretty much out of luck if you don't have the source code. If you do have the source code, does the programming IDE (Visual Studio?) show an active breakpoint or not? Lastly, do you mean 'spdlog' (not 'speedlog')?


However, unless you know how the logger has been set up, it's all guesswork trying to discover how to trigger it.
 
Messages
20
Country
belgium
I think you are pretty much out of luck if you don't have the source code. If you do have the source code, does the programming IDE (Visual Studio?) show an active breakpoint or not? Lastly, do you mean 'spdlog' (not 'speedlog')?


However, unless you know how the logger has been set up, it's all guesswork trying to discover how to trigger it.
I do have the source code available but apart from what I have added it is quite "chinese" to me. I use Visual Studio Community 2022.
I meant spdlog indeed.
 

DragonflightDesign

Resource contributor
Messages
892
Country
northernireland
Is the breakpoint an active breakpoint i.e. when you attach the debugger to P3D, do you get a solid red-brown circle next to the line you want the debugger to stop at?
 
Messages
20
Country
belgium
Is the breakpoint an active breakpoint i.e. when you attach the debugger to P3D, do you get a solid red-brown circle next to the line you want the debugger to stop at?
Yes I get it! It does never trigger however. I know the code gets executed however because it gives me the correct result in the sim.
 

DragonflightDesign

Resource contributor
Messages
892
Country
northernireland
One of the reasons for what you are seeing is that you are not looking at the source code that is actually executing i.e. you have the same .cpp file in two different directories and you have attached the breakpoint to the .cpp file that is not actually in the project build. Check the footer bar in the document well - if you are using VS2019 then the path is automatically shown in the footer. If you are using VS2017 or less, go to

Tools | Extensions and Updates

and search Online for 'File Path On Footer'. Install the extension.
 
Top