Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

V31 running DevStudio post-build event?

May
12,949
172
I have this command line for my "4UTILS" project's post-build event.

Code:
d:\tc31\tcc.exe /c u:\postbuild.btm $(TargetPath)

The first few lines of u:\postbuild.btm (with some debug ECHOs) are

Code:
REM %1 is DevStudio's $(TargetPath)
echo _4VER = %_4ver
echo %%1 = %1
dumpbin /headers %1 | ffind /k /m /t"number of sections"
echo xx = %@execstr[dumpbin /headers %1 | ffind /k /m /t"number of sections"]
set nSections=%@word[0,%@execstr[dumpbin /headers %1 | ffind /k /m /t"number of sections"]]
echo nSections = %nSections

When I run it manually, it does what I want.

Code:
v:\> d:\tc31\tcc.exe /c u:\postbuild.btm p:\4Utils\x64\Release\4Utils64.dll
_4VER = 31.01
%1 = p:\4Utils\x64\Release\4Utils64.dll
               6 number of sections
xx =                6 number of sections
nSections = 6
              size       .text      .rdata       .data      .pdata      _RDATA      .reloc
Before      326144       31B40       1824E        5500        2388         1F4         9CC
After       326144       31B40       1824E        5500        2388         1F4         9CC

When devenv runs it, it fails.

1707249679666.png


It works fine if I change the post-build event command line to use TCC v30.

1707250215731.png


This was working OK recently so I suspect the latest build of v31.
 
[Repackaged] Here are v30 and v31 in a VisualStudio "terminal".

1707251435241.png
 
Just out of curiosity, what if you ran u:\postbuild.btm through bdebugger;
Code:
d:\tc31\tcc.exe /c bdebugger u:\postbuild.btm $(TargetPath)

Joe
 
If I make that the actual post-build event I see no output, anywhere!, and BDEBUGGER shows the variables NOT being set. When I run that command line in DevStudio's "terminal" it misbehaves exactly as in my previous post and BDEBUGGER shows the variables not being set.
 
Through process of elimination,
change the command line to eliminate startup files through use of the /I option
(/II /IL /IP /IS /IX)

Just a suggestion.

Joe
 
Your postbuild.btm seems to work OK here (Visual Studio 2010, TCC 31.01.22.)

You might add a WHICH DUMPBIN to check that you're getting the one you think you're getting.
 
Your postbuild.btm seems to work OK here (Visual Studio 2010, TCC 31.01.22.)

You might add a WHICH DUMPBIN to check that you're getting the one you think you're getting.
I had checked on the DUMPBIN; it's OK. I'm pretty sure the "Output" window is based on a newer technology (than in VS2010). Ditto for the "terminal" (do you have that ... View menu\Terminal or Ctrl+backtick).

The DUMPBIN | FFIND works, but not inside @EXECSTR. As I said, this was working a few days ago (and for ages before that). I think a recent change broke it.
 
I started up Process Explorer, which shows that the Terminal in VS2022 uses OpenConsole.exe, while a stand-alone TCC uses conhost.exe

Not sure if that matters in your case,
but maybe something to consider.

Joe
 
I started up Process Explorer, which shows that the Terminal in VS2022 uses OpenConsole.exe, while a stand-alone TCC uses conhost.exe

Not sure if that matters in your case,
but maybe something to consider.

Joe
I'm aware of that but I don't think it's the problem. It all works fine in Windows Terminal, which also uses OpenConsole.exe. And it fails in VS2022's output window or terminal window. I tried replacing VS2022's OpenConsole.exe with the one from WindowsTerminal; that made no difference.

The problem is surely related to the construction @execstr[dumpbin | ffind] and (I'll say again) it just started in the last couple days and it works with any older TCC.

FWIW, If, instead, I dumpbin > file and @execstr[ffind ... file] it works fine.
 
The problem is surely related to the construction @execstr[dumpbin | ffind] and (I'll say again) it just started in the last couple days and it works with any older TCC.

Try putting strong quotes around @EXECSTR's args?

Do you want my @EXECSTR for comparison purposes?
 
Quotes don't help. No, thanks.

I discovered that this failing line

Code:
set nSections=%@word[0,%@execstr[dumpbin /headers %1 | ffind /k /m /t"number of sections"]]

works if I use

Code:
set nSections=%@word[0,%@execstr[dumpbin /headers %1 | grep "number of sections"]]

or

Code:
set nSections=%@word[0,%@execstr[dumpbin /headers %1 | findstr "number of sections"]]
 

Similar threads

Back
Top