• 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.

FSX R6031 Run Time Error

cheangjc

Resource contributor
Messages
111
Country
singapore
Hi,

I am having trouble with the C++ gauge I created. Whenever the aircraft is reset or FSX is exited, R6031 Run Time Error appears.

The weird thing about this error is that its that it does not appear on my machine, but a tester machine. I am using VS2008 and have asked the tester to install all VS 2008 Redist. Also, when using Release version of the gauge, FSX crashes on my tester system while Debug Version produces that run time error.

Any ideas on how to solve this? I can post parts of the code if needed.
 
http://msdn.microsoft.com/en-us/library/ms173740.aspx

Not the most descriptive of errors, to be sure. Your might try doing all your initialization routines during the first instance of PANEL_SERVICE_PRE_UPDATE, rather than during CONNECT_TO_WINDOW, or during module_init.

During aircraft load, gauges are loaded, unloaded, and then loaded again. I think the first load is simply to check for module dependencies. I have noticed that one must take care with dynamic memory allocations because of this behaviour.

Doug
 
It seems to me another reason for avoiding managed code which overcomplicates thing for my simple mind!
 
http://msdn.microsoft.com/en-us/library/ms173740.aspx

Not the most descriptive of errors, to be sure. Your might try doing all your initialization routines during the first instance of PANEL_SERVICE_PRE_UPDATE, rather than during CONNECT_TO_WINDOW, or during module_init.

During aircraft load, gauges are loaded, unloaded, and then loaded again. I think the first load is simply to check for module dependencies. I have noticed that one must take care with dynamic memory allocations because of this behaviour.

Doug

I use the GDI Gauge template from ESP and modified it a little. This is my current code. Currently, I am not using the gauge to draw anything, its more of a "logic" gauge. The only init routines are to register the LVars. I used no dynamic memory allocations for the matter (its a very simple gague now).

template <class T>
inline void FSAPI Gauge::Callback(GAUGEHDR* gau, int serviceId, unsigned)
{
switch(serviceId)
{
case PANEL_SERVICE_CONNECT_TO_WINDOW:
break;

case PANEL_SERVICE_DISCONNECT:
break;

case PANEL_SERVICE_PRE_UPDATE:
//Called each time the gauge taken values are updated (18hz)
UpdateLVARs();
DoMain18hz();
SetLVARs();
break;

case PANEL_SERVICE_PRE_DRAW:
//Called each time the gauge is to be re-drawn each frame
RegisterAndCheckAllLVars();
break;
case PANEL_SERVICE_PRE_INITIALIZE:
break;
case PANEL_SERVICE_POST_INSTALL:
break;

}
}
 
Last edited:
Just a update,

Changing the Runtime Library from Multi thread DLL to Multi threaded seems to solve this issue for me, I will continue to keep an eye on this.
 
Just a update,

Changing the Runtime Library from Multi thread DLL to Multi threaded seems to solve this issue for me, I will continue to keep an eye on this.

Yes, you can never really count on users having the required version of the run time libraries installed. Making the change you did results in the Windows API functions your are using being embedded in your application, rather than being called from the run time library. Makes your executable or dll quite a bit larger, but you don't have to worry about whether the user has the library files installed.

Doug
 
Back
Top