The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.
#78409 by dhs
Tue Jul 21, 2020 2:48 pm
I recently spent a few hours trying to work out why several options crashed in the latest build of my newest macro. I had made only very minor code changes, but I had changed the build configuration from 'Debug' to 'Release'. Changing back to a 'Debug' build fixed the problems without any further code changes. I obviously have a pretty short memory as I later recalled that the Spaces macro uses a Debug build for the exact same reason.

Can anybody give any insights into why this can happen ? (I would be very grateful for suggestions, although sadly I suspect that Dave G was the person on this forum most likely to be able to explain it).

The other reason for posting this is to alert any others using D4D of this symptom ... hopefully the knowledge can save you the few hours of head-scratching that I spent pondering the problem!
#78411 by dhs
Tue Jul 21, 2020 3:34 pm
ok, as happens I have thought about this a bit more since the original posting...

I was using Delphi's default Debug & Release configurations, so I tried editing the Release Configuration. I changed the Release Configuration to NOT do Optimization and the release build now runs in Dcad without any problems (although I'm not certain that the release build is now that much different to the Debug build ... the file size for both is now the same whereas previously the release build was slightly smaller).

I don't know for sure, but I am wondering if the default release build eliminated the filler field in the following code snippet (I have a few places in the code with similar fillers):
Code: Select all  {$Hints off}     // Supress hint about filler not being used.
  function HiliteByAtr (AtribName : atrname; colour : integer) : boolean;
  /// colour of zero will UNhilite, result inicates if any entities were hilited.
  var
    filler : byte;  // Without this filler the AtribName parameter gets corrupted by mode_init call.
                    // I expect that it has something to do with mode_type having an odd number of bytes and
                    // mode_init operating on a word-aligned area of memory, but Mark/Dave have been unable
                    // to reproduce the problem even though similar symptoms have happened for me predictably
                    // in multiple projects

    mode : mode_type;
    atr : attrib;
 

The use of mode_init was causing crashes for me in a previous project and although Dave/Mark looked into it for me they could not reproduce the problem (even though it occurs predictably for me ... they must have some different compiler setting, but I never managed to get to the bottom of it so have just been including a filler in my code to avoid it). If the filler in this code is eliminated then I expect that could cause crashes....

Who is online

Users browsing this forum: No registered users and 2 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for AEC Professionals Since 1984