Has something with Declares changed drastically in releases after 2014r2.1?

I have a large application that I’ve been developing over the course of several years now. I’ve generally been keeping up with recent Xojo releases, but as of about 2014r3.1 I’ve been prevented from using the latest because of a very difficult to diagnose problem with Declares. The exact same project file runs (builds, etc.) fine in 2014r2.1 but in newer Xojo releases, the application starts, but immediately exits upon calling a declare. The really irritating thing is that there are zero error messages, or any other info that I can see (EventViewer, etc.). It just dies. And it’s specifically with Windows (debugger and built apps). Project file is a Xojo Binary Project if that matters.

I know that string handling has recently undergone some changes, so I thought maybe that might be something to do with it (specifically with the Library name, which I currently have stored as a String Constant) I set up my declares as e.g. “Declare Function ExternalFunctionName Lib MyStringConstant (foo as Integer) as Integer”. I tried changing from a constant to a literal, e.g. “Declare Function ExternalFunctionName Lib “MyLibraryName.DLL” (foo as Integer) as Integer” but that had no effect. I also tried changing the String Constant type to “Text”, also no change.

Any ideas what might be going on? Yes, I know, “make a sample project that demonstrates the problem and file a Feedback report”…I know, I know, and I will eventually try to put that together; for now I’m just wondering if I’ve maybe overlooked something obvious that I can get this solved quickly.

Are you maybe missing DLL ?
If its not declared as SOFT then at launch the app tries to locate & load all the DLL’s at start up
Any missing will cause the app to not start

Try starting it from a command window just typing the exe name
And also grab a copy of DebugView that will show any system logged messages

I’m reasonably certain that I’m not missing a DLL. I come to this conclusion because the exact same project file (with same supporting files, etc.) works fine under Xojo 2014r2., but fails with 2015r1 (and others since 2014r2.1) (debugger and built app). No change apart from opening in a different version of Xojo.

DebugView shows nothing at all for the built app (Xojo 2015r1), which starts (I can tell it’s doing something, because it blinks my “splash screen” window) then immediately quits/crashes/halts with no message dialogs or any other information (that I can see, anyway).

When running in the debugger I see:
[180] pre build
[180] Skipping property Backdrop of type Picture with value 0
… a bunch of these ‘Skipping property’ messages for various controls and windows…
[180] post build
[180] Execute step CopyFiles1
[180] Execute step CopyFiles2
[180] Execute step CopyFiles3
[180] Execute step CopyFiles4
[180] Command “RunApp” handled by Window “Xojo - [myProject.xojo_binary_project *]”
[180] Command “Resume” handled by Window “Xojo - [myProject.xojo_binary_project *]”

Similarly, the app dies immediately. I placed a breakpoint on the line where the declare is called; it gets that far but when I step through, it dies. No error dialog or messages of any sort.

I know that on OSX and iOS this indicates that the declare is bad and its time to see what I have done wrong.

I’m trying to figure out how a declare would go “bad” simply by using different versions of Xojo. Again, there has been change to the Xojo project file, no change to the DLL I’m calling, no changes at all other than opening the project file in a newer Xojo.

I’m open to the idea that I’m doing something wrong, but there’s obviously been some change to Xojo that makes things that were previously working fine now bad.

Do you have structures with CStrings in them? or declares taking CStrings?

This may be stating the obvious, but I think you are at that point. At least a small example file you can share with the people on this thread trying to help you (if you don’t want to go the full length of the FR.

Yes, but the crash occurs before I even get to declares taking those.

I don’t disagree with you; trouble is that with a large project such as I have, whittling it down to just the stuff that reproduces the issue is going to be rather time-consuming, not to mention frustrating: I tried creating a new project and setting up only the declare that causes the crash, and that does not cause a crash in the new project file. So it seems there’s something else about the project file or other contents going on that newer Xojo doesn’t like. I have hundreds of declares to go through, not to mention avoiding exposing any of my company’s sensitive information.

Start adding System.DebugLog statements to pin down how far it gets and hopefully, the declare that is going bad.

I made somewhat of a discovery on this: my development machine (where this is failing) is Windows 7 x64, updated with all current SPs. Out of frustration, I decided to try the Xojo 2015r1-built app on a Windows 8.1 machine and was surprised to discover that it worked fine there.

That gave me the idea to try Compatibility Mode for Windows 7. I toggled this on with Properties -> Compatibility Tab, ‘Run this program in compatibility mode for: Windows 7’ and it then ran fine there, too. So I don’t think this crash actually has anything directly to do with my code or libraries (which has been untouched and working fine for nearly 2 years of development in various releases of Xojo).

However: I’m still unable to get my project to run in the debugger (because the Debug version of my app does not set the Compatibility Mode flag). Is there any way to control that from Xojo? There’s no Build option for it that I can see. I can probably limp along with only running the built app, but it really hinders development not to have the Xojo debugger. I tried setting the flag on Xojo itself but my project still crashes with that in the debugger.

I found all of this is really surprising. I don’t think I’ve ever needed to set Compatibility Mode with a Xojo-built Windows application (or even a RB one…I’ve been doing this since RB 3.5 or so). Is it expected that I’d need to do this with Xojo post-2014r2.1?

No.

OK, that’s good, I guess…but now I want to figure out why this appears to fix the issue (in the built app at least…would still like to figure out how to make it work in the debugger). What does Compatibility Mode do, anyway?