November 2, 200916 yr Commercial Member Hi,I have come across a very annoying problem with one of my gauges: it works fine when I run the gauge in VS2008-debug mode, but it generates errors when I compile in "release" mode.The problem most likely is related to a memory allocation problem with a pointer or array.It would make my life a lot easier if I could open a console window from my gauge to write some variable values to, so I can see what is happening inside the gauge exactly!Has anyone been able to do this and would you share this knowledge ?Thanks,Bj Bj
November 2, 200916 yr Moderator The simplest approach would be to use a Message Box: // declare these in your gaugename.h file:HRESULT ErrorHr; // holds the Hresult #define FS2_ERROR_CALLBACK_MESSAGE_LENGTH_MAX 1024TCHAR messagetext[FS2_ERROR_CALLBACK_MESSAGE_LENGTH_MAX]; // will hold error Message// Add the MessageBox wherever you need it in your gauge code:else if (ErrorOccured == 1){ ErrorOccured = 0; StopWorking = 1; _stprintf(messagetext, _T("This Module will only work with Licensed Lionheart Creations Aircraft."), ErrorHr); MessageBox(NULL, messagetext, _T("FBDS License Invalid."), MB_OK);} You can easily pass anything to a MessageBox.As an aside, you may well simply be missing some required dependencies from your Release compile. Use DependencyWalker to see what -if anything- is missing... Fr. Bill AOPA Member: 07141481 AARP Member: 3209010556 Avsim Board of Directors | Avsim Forums Moderator
November 2, 200916 yr Commercial Member The majority of errors that show up only in 'Release' compiles are indeed related to memory allocation... however, bad indexing into data arrays can also cause it. The 'Debug' compile runs inside a protected space and thus doesn't crash under many conditions the 'Release' compile will. Ed Wilson Mindstar AviationMy Playland - I69
November 3, 200916 yr Author Commercial Member Hi guys,I tried the messagebox approach earlier on and it is simple and works but.... not very handy if you want to show a lot of data and do many checks and it really breaks the flow of things.I ended up creating a log file using the code I found here:http://www.infernodevelopment.com/c-log-fi...orget-debuggersVery easy to implement and works very nicely.Bug isn't solved yet but at least I have a good instrument now to find it...Thanks,Bj Bj
Create an account or sign in to comment