Board index » cppbuilder » Re: bcc32pch - commandline compiler replace for buildin compiler

Re: bcc32pch - commandline compiler replace for buildin compiler


2005-09-14 09:38:39 PM
cppbuilder80
I've uploaded a new version to
andy.jgknet.de/cpp/
You must replace both the plugin and bcc32pch.exe by the new one.
Changes:
# Fixed endless loop in splitting -I command line option.
# Errors without a filename in the message are now recognized as errors.
# Added bcc32.exe replacement option.
# Secured plugin unload code.
# Message/Compile dialog auto closes when starting the application.
# bcc32pch can show the bcc32's command line.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Harald Plontke wrote:
Quote
Package C:\Programme\Borland\CBuilder6\Bin\bcc32pchPlugin60.bpl kann
nicht geladen werden. Access violation at address 066F... Read of
address 000... Soll dieses Package beim Laden des nächsten Projekts
geladen werden?" (Package xxx can not be loaded...)
Could you download the newest version. I've added a BCB6 package to it so
you can debug it.
1. Remove the bcc32pch package from the IDE.
2. Close all projects and open the ide/source/bcb/bcc32pch.bpk file
3. Adjust the "Run/Parameters" (Start/Parameter...") Host application to
"C:\WhereBCBis\Bin\bcb.exe /ns"
4. "Start" the package (the second BCB instance will show up)
5. Place a Breakpoint in the bcc32pch_Main.pas in line 293
(TBcc32PchNotifier.Create).
6. Add the bcc32pchPlugin60.bpl package to the second instance. (the
breakpoint should be hit)
7. Step through the code and find the function that causes the AV
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Hello,
Quote
Could you download the newest version. I've added a BCB6 package to it so
you can debug it.
I will do this. Unfortunately it seems, my BCB is broken, after more AVs I
cannot start programs in the de{*word*81} anymore, I get AV at every attempt to
start "MyProject".exe from within the IDE. Before that, I had the behaviour,
that on every "step over" in the de{*word*81} the IDE asks for "sourcecode has
changed, will you recompile", which was not from the beginning, when I
installed bcc32pch. It seems I had to reinstall BCB. I removed your package
from the IDE, but the error remains.
The "MyProject".exe runs fine, if I start it outside the IDE.
I am on a bussines trip for the rest of the week, but I will try to debug
your package next week.
Greetings,
Harald
 

{smallsort}

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

"Andreas Hausladen" < XXXX@XXXXX.COM >wrote:
Quote
Changes:
# Fixed endless loop in splitting -I command line option.
# Errors without a filename in the message are now recognized as errors.
# Added bcc32.exe replacement option.
# Secured plugin unload code.
# Message/Compile dialog auto closes when starting the application.
# bcc32pch can show the bcc32's command line.
I installed the latest version in my BCB5. But when I try to compile, I get the error "E2266: No file names given".
I turned on the Detailed message window. If I run the actual command in a CMD window, I get \1\2\3\4852\n and then the E2266 message. (Why the symbols?)
I think the problem is with the quote marks in the -I option; if I change the first " to be \" in the CMD window then it compiles correctly -- I suppose this is a bug in your program. If I change my include list to not have any pathnames with spaces, then your program works.
NB. I don't actually want "C:\Program Files\Borland\CBuilder5\Projects\" in my include path, but the IDE seems to regularly insert it there and I don't feel the motivation to delete it every time.
Also, I have a feature request: can you add the "Close on successful compilation" checkbox to the configuration page too. If I have accidentally ticked it, then the compile window can succeed and disappear too quickly for me to untick it!
Here is the output from the Detailed message window:
MAKE Version 5.2 Copyright (c) 1987, 2000 Borland
C:\PROGRA~1\Borland\CBUILD~1\Bin\..\BIN\bcc32pch -showprocessid -bcc32= -showcmd -pch="ConfigWizard_pch.h" -q -Od -H=C:\PROGRA~1\Borland\CBUILD~1\Bin\..\lib\vcl50.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c -tW -tWM -w-par -I"C:\Program Files\Borland\CBuilder5\Projects\";C:\PROGRA~1\Borland\CBUILD~1\Bin\..\include;C:\PROGRA~1\Borland\CBUILD~1\Bin\..\include\vcl -D_DEBUG;_RTLDLL;NO_STRICT;USEPACKAGES -n .\MainForm.cpp
Error E2266: No file names given
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

"Old Wolf" < XXXX@XXXXX.COM >wrote:
Quote

I installed the latest version in my BCB5. But when I try to compile, I get the error "E2266: No file names given".

I think the problem is with the quote marks in the -I option
I have tracked down the problem a bit more since my original post. The problem is that if a path has a trailing slash and is enclosed in quotes, then the \" combination causes a problem at some stage of the bcc32pch processing (ie. it thinks it is an escaped quote mark and does not recognize the end of the included files list).
I had the same problem in another project where the .BPR file shows the include path as:
<INCLUDEPATH value="$(BCB)\include;$(BCB)\include\vcl;..\CommonLib;"C:\
X\tidy\include\""/>
(but those quotes don't show up in the IDE so I can't try it without them there!)
Note: This may also occur in the Library path.
I have also encountered another problem: on a .LIB or .DLL project, there is an access violation as soon as I choose "Build" or "Compile". The plugin only seems to work for .EXE projects.
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Old Wolf wrote:
Quote
I turned on the Detailed message window. If I run the actual command in
a CMD window, I get \1\2\3\4852\n and then the E2266 message. (Why the
symbols?)
The \1\2\3\4<ProcessId>\n is for the plugin to find the process id easily.
I need the bcc32.exe's process id to kill it when you click the "abort"
button. Otherwise I could kill make.exe and bcc32pch.exe but bcc32.exe
doesn't look interested in beeing stopped. It compiles the remaining files
and then stays resident without any action.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Old Wolf wrote:
Quote
if a path has a trailing slash and is enclosed in
quotes, then the \" combination causes a problem at some stage of the
bcc32pch processing (ie. it thinks it is an escaped quote mark and does
not recognize the end of the included files list).
No it's not a command line processing bug.
That's who bcc32pch.exe calls bcc32.exe.
"C:\Borland\CBUILD~2\BIN\bcc32.exe" -q -WD -Od
-H=C:\Borland\CBUILD~2\Bi
n\..\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -tWD -tWM -c
-w-par
-Iwinlayer;"C:\Program
Files\Borland\CBuilder5\Projects\";C:\Borland\CBUILD~2\B
in\..\include;C:\Borland\CBUILD~2\Bin\..\include\vcl
-D_DEBUG;NO_STRICT;_NO_VCL;
_RTLDLL -nobj\ .\Main.cpp
Error E2266: No file names given
You see that bcc32pch only removes it's own parameters and then sends the
GetCommandLine() to bcc32.exe.
It's bcc32.exe which interprets the \" as escape sequence. So I must
change the makefile so that such an escape sequence is not generated.
Quote
I have also encountered another problem: on a .LIB or .DLL project,
there is an access violation as soon as I choose "Build" or "Compile".
The plugin only seems to work for .EXE projects.
I cannot reproduce this. I'll add JCL Debug information to the BPL so you
can see where it crashes (if not in the IDE itself)
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Old Wolf wrote:
Quote
I have also encountered another problem: on a .LIB or .DLL project,
there is an access violation as soon as I choose "Build" or "Compile".
The plugin only seems to work for .EXE projects.
You have BCB5. I cannot test this version because I do not have BCB5. I
can only test the loading and unloading of the plugin by using it in
Delphi 5. But there is no C++ Compiler in Delphi 5 I could hook.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Old Wolf wrote:
Quote
I installed the latest version in my BCB5. But when I try to compile, I
get the error "E2266: No file names given".
Could you try the debug version (includes DJcl50.bpl compiled from CVS
snapshot)
andy.jgknet.de/cpp/files/bcc32pchide_debug.zip
Install: Copy all files *50.* files to $(BCB)\bin.
This version shows a stacktrace of the plugin when an exception occurse.
For the stack trace the .map files is important. Without it you will only
see memory addresses.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

"Andreas Hausladen" < XXXX@XXXXX.COM >wrote:
Quote

Could you try the debug version (includes DJcl50.bpl compiled from CVS
snapshot)
andy.jgknet.de/cpp/files/bcc32pchide_debug.zip
Install: Copy all files *50.* files to $(BCB)\bin.

This version shows a stacktrace of the plugin when an exception occurse.
For the stack trace the .map files is important. Without it you will only
see memory addresses.
This makes no difference -- as soon as I choose Compile, I get a MessageBox with:
Access violation at address 520EE55A in module 'CorIde50.bpl'. Read of address 00000000.
The bcc32pch window never appears.
Also, this new version (both the debug, and the latest non-debug) introduce a new problem: if I choose Tools>Configure Bcc32pch, I get a MessageBox with the error:
Error reading FormBcc32PchOptions->DesignSize: Property does not exist.
and the configuration window never appears. Checking with FILEMON, I see that it does not even access the harddrive while doing this, so I don't really know what it is looking for.
This problem didn't happen with the version I was using last week.
BTW -- when it does work it is very fast -- a great idea for software! Thanks for your time and efforts.
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Andreas, I have some more information regarding the crash.
It appears to depend on which files are currently open in the BCB editor.
If I close all open files, then all of my projects (.LIB, .DLL included) compile successfully. If I open certain files (even if they are not part of the current project!), then the crash occurs. Some files cause the crash and some don't, I have not been able to find a common factor between the ones that do and the ones that don't.
If I go File>New>Unit, then the new unit always does cause the crash. However, if I go File>New>C file, and save the new file as .cpp, the crash does not occur.
Some other problems I found while doing this testing: if you click 'Abort' while Bcc32pch is compiling the precompiled header, then all the .cpp files have changed to have your code in them, and all the .original.cpp files are{*word*154} around. They revert after about 60 seconds (I guess that even after the bcc32pch results window closes, some other process is cleaning up).
Can I suggest not altering the original files, and injecting your code into the new temporary files? I can't see any reason why the compiler would care if a file had a different filename.
Also, after bcc32pch has compiled a project, the BCB title window says " ... [Built 0.00 secs]", instead of the correct time. This is more cosmetic than functional though :)
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

"Old Wolf" < XXXX@XXXXX.COM >wrote in message
Quote
Can I suggest not altering the original files, and injecting your code
into the new temporary files? I can't see any reason why the compiler
would care if a file had a different filename.
But it would be much harder to debug.
Des
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Old Wolf wrote:
Quote
Error reading FormBcc32PchOptions->DesignSize: Property does not
exist.
That's something Delphi 6 / BCB 6 introduces into the .dfm file if you use
anchors. Delphi 5 and BCB 5 do not support this property. I always opened
the .dfm files in notepad and removed that property. But as this is extra
work I must have fogotten it in the last update.
Quote
This makes no difference -- as soon as I choose Compile, I get a
MessageBox with: Access violation at address 520EE55A in module
'CorIde50.bpl'. Read of address 00000000.
The question is if anyone else tried the bcc32pch Plugin with BCB 5. Or
are all the others using BCB 6.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Old Wolf wrote:
Quote
Some other problems I found while doing this testing: if you click
'Abort' while Bcc32pch is compiling the precompiled header, then all the
.cpp files have changed to have your code in them, and all the
.original.cpp files are{*word*154} around. They revert after about 60
seconds
That can't be true. bcc32pch.exe compiles the PCH file before it injects
the code. So make.exe seems to proceed even the plugin kills it before it
kills something else.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:Re: bcc32pch - commandline compiler replace for buildin compiler

Hello Andreas,
today I tried to compile the bcc32pchPlugin.bpk, but I get
[Pascal Fataler Fehler] bcc32pch_Main.pas(17): Datei nicht gefunden:
'ToolsAPI.dcu'
[Linker Fataler Fehler] Fatal: Unable to open file 'BCC32PCH_MAIN.OBJ'
I will now try the debugversion.
Harald