forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

"Mixed" projects: compiling program units with different compile options and linking them

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Mon Jun 26, 2006 7:54 am    Post subject: "Mixed" projects: compiling program units with dif Reply with quote

Several of my applications manipulate image data, consisting of arrays of single characters. For these applications, I don't use Checkmate because of the way it "detects" undefined variables (using a specific byte value). For image data, this specific byte value is as good as any other, and so every time it occurs legitimately it generates a false positive runtime error - as a result, I build these apps with /debug as the highest diagnostic level. Unfortunately, this throws the baby out with the bathwater, where "baby" = all the other stuff that Checkmate does, which I /would/ like to use - but it's all too easy to forget that I'm working without the Checkmate safety net.

I just got reminded of this when I had to track down a puzzling data overwrite which turned out to be due to a write past the end of an array - that Checkmate would have identified (I just checked, and it did, at runtime; however, before I even got that far, I got a compile-time warning that has got me worried about something else now - see separate post).

Which leads me to my question:

In principle, different program units could be compiled with different compile options, and linked to form an exe with different levels of diagnostic power in different parts. Assume I reorganise my code so that I separate out the parts where I need to forsake Checkmate as a compile option. I end up with program units that need to be compiled with different compile options, and then linked. Can I do this within Plato? If not, how would I go about it in a command line manner?
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Mon Jun 26, 2006 10:06 am    Post subject: "Mixed" projects: compiling program units with dif Reply with quote

Andy

Plato applies the same compiler options to every file within a project, i.e. one set for Release, one for Debug and one for CheckMate.

One approach you might try is to use OPTIONS(CHECK) etc in the code together with conditional compilation code. You could then set the appropriate VPARAM (for example) in the project properties.

Otherwise you may end up writing a compile and link batch file to run from a DOS box.
Back to top
View user's profile Send private message AIM Address
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Tue Jul 04, 2006 5:35 am    Post subject: "Mixed" projects: compiling program units with dif Reply with quote

I've made some progress on this now. I isolated the code that needs to be compiled as /DEBUG into a little separate module. I build the entire project as both /DEBUG and /CHECKMATE, and copy the object code for the module in question from DEBUGWIN32 TO CHECKMATEWIN32 (overwriting or renaming the original version). The problem is how to relink the revised object code without recompiling. At first I tried rebuilding the /CHECKMATE version from within Plato; I figured that if changed source code triggers recompilation and relinking, unchanged source code but changed object code might trigger relinking only. This worked the first few times - then it stopped working, with Plato insisting "Target is up to date" and not invoking SLINK, so I wrote a batch file to do the job.

Q: how does Plato "know" when recompilation and relinking are necessary i.e. why would my original approach work sometimes, but not consistently?
Back to top
View user's profile Send private message Send e-mail
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7927
Location: Salford, UK

PostPosted: Tue Jul 04, 2006 5:45 am    Post subject: "Mixed" projects: compiling program units with dif Reply with quote

Andy

The next release of Plato has an improved method for testing when to compile and when to link.
Currently you get a recompile and relink for almost any change to the project properties.
In the next release the properties are classified as to whether they require a recompile, or a relink or neither.

I do not know why you are get an inconsistent behaviour but hopefully everything will be OK in the next release.
Back to top
View user's profile Send private message AIM Address
sparge



Joined: 11 Apr 2005
Posts: 371

PostPosted: Tue Jul 04, 2006 6:01 am    Post subject: "Mixed" projects: compiling program units with dif Reply with quote

Good news. It seems I am pushing on an open door - is that the right figure of speech? Thanks.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group