News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

UAsm WinInc and the CStr mystery

Started by jj2007, February 23, 2024, 12:34:42 AM

Previous topic - Next topic

fearless

lea rbx, wcx - shouldnt that be lea rbx, wc
also the @64 complains in the CreateWindowEx line - Error A2102: Symbol not defined : @64

 

jj2007

Quote from: fearless on February 24, 2024, 07:12:45 AMlea rbx, wcx - shouldnt that be lea rbx, wc

No, wcx is a global variable, ws is the equate

Quotealso the @64 complains in the CreateWindowEx line - Error A2102: Symbol not defined : @64
Fixed, thanks.

Now it builds fine - new version attached.

_japheth

Quote from: jj2007 on February 24, 2024, 06:42:34 AMI got the WinMain problem half solved: Error A2262: Missing .ENDPROLOG: WinMain
Yep, UAsm and JWasm can, apparently, not imagine that a proc can be left with ExitProcess instead of a ret.

Hm, .ENDPROLOG surely has nothing to do with ret, it's a prologue, not an epilogue problem.

QuoteBut now the Error A2142 moved to WndProc :rolleyes:

Those "unmatched block nesting" errors occur when the PROC and ENDP directives of a procedure aren't in the same segment.
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

jj2007

Quote from: _japheth on February 24, 2024, 01:38:52 PMThose "unmatched block nesting" errors occur when the PROC and ENDP directives of a procedure aren't in the same segment.

That was indeed the problem, thank you. More specifically:
Chr$ MACRO args:VARARG
Local NewString
  .DATA
  NewString db args, 0
  .CODE
  EXITM <offset NewString>
ENDM
WinMain proc ....
  ...
  invoke CreateWindowEx, 0, wc.lpszClassName, Chr$("Hello World"), ...
  ret
WinMain endp

Looks harmless, right? Except that the whole WinMain was erroneously in the .DATA section, so when Chr$() is being used, there is a switch from .DATA to .CODE :rolleyes:

IMHO some work on error detection/error messages would do no harm: a PROC in the .DATA section, really?

jj2007

#19
Quote;--- include file created by h2incx v0.99.10, copyright 2005 japheth
;--- source file: c:\programme\devstudio\vc6\include\WINDOWS.H, last modified: 4/24/1998 0:0

Japheth,

Any chance to update the set of WinInc include files? Can h2incx handle recent *.h files, or have they become too complex? Gcc has the -E and -P options, they might be helpful to reduce the complexity.

sinsi

QuoteLooks harmless, right? Except that the whole WinMain was erroneously in the .DATA section, so when Chr$() is being used, there is a switch from .DATA to .CODE
Now jj, admit it, that's a coder error :biggrin:

Of course, if it was deliberate, you could use @CurSeg to restore the original segment
🍺🍺🍺

jj2007

Quote from: sinsi on February 24, 2024, 11:57:22 PMNow jj, admit it, that's a coder error

Obviously, that's why we all look so old - bugchasing nights :badgrin:
Re @CurSeg, I use that occasionally in macros that make sense in both .code and .data

_japheth

Quote from: jj2007 on February 24, 2024, 07:46:13 PMIMHO some work on error detection/error messages would do no harm: a PROC in the .DATA section, really?

It's copied from Masm: if you define a code label (symbol with a trailing colon) in .data, you'll get an error, but to define a proc is ok ( so long as it contains no labels ).

Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.

jj2007

Quote from: _japheth on February 25, 2024, 01:07:49 AMto define a proc is ok
So for the sake of compatibility, we keep the odd behaviour, too? IMHO there should be at least a warning...


I'm having fun with gcc.exe -S -E -P -o out.h ~tmp4Gcc.cpp :cool:
  1  bfd.h                                #error config.h must be included before this header              4  ctf-api.h                            zlib.h: No such file or directory                                7  dis-asm.h                            #error config.h must be included before this header              8  plugin-api.h                          #error cannot find uint64_t type                                90  specfun.h                            #error include <cmath> and define __STDCPP_WANT_MATH_SPEC_FUNCS162  codecvt_specializations.h            iconv.h: No such file or directory                            165  enc_filebuf.h                        iconv.h: No such file or directory                            233  glue_execution_defs.h                #error "The parallel backend is neither serial nor TBB"        240  numeric_impl.h                        #error "The parallel backend is neither serial nor TBB"        243  parallel_backend_tbb.h                tbb/blocked_range.h: No such file or directory                246  pstl_config.h                        #error "The parallel backend is neither serial nor TBB"        261  special_function_util.h              #error do not include this header directly, use <cmath> or <tr1283  extc++.h                              iconv.h: No such file or directory                            306  extc++.h                              iconv.h: No such file or directory                            325  stdio.h                              ssp.h: No such file or directory                              326  string.h                              ssp.h: No such file or directory                              327  unistd.h                              ssp.h: No such file or directory                              329  adxintrin.h                          #error "Never use <adxintrin.h> directly; include <immintrin.h>331  avx2intrin.h                          #error "Never use <avx2intrin.h> directly; include <immintrin.h332  avx5124fmapsintrin.h                  #error "Never use <avx5124fmapsintrin.h> directly; include <x86333  avx5124vnniwintrin.h                  #error "Never use <avx5124vnniwintrin.h> directly; include <x86334  avx512bf16intrin.h                    #error "Never use <avx512bf16intrin.h> directly; include <immin335  avx512bf16vlintrin.h                  #error "Never use <avx512bf16vlintrin.h> directly; include <imm336  avx512bitalgintrin.h                  #error "Never use <avx512bitalgintrin.h> directly; include <x86337  avx512bwintrin.h                      #error "Never use <avx512bwintrin.h> directly; include <immintr338  avx512cdintrin.h                      #error "Never use <avx512cdintrin.h> directly; include <immintr339  avx512dqintrin.h                      #error "Never use <avx512dqintrin.h> directly; include <immintr340  avx512erintrin.h                      #error "Never use <avx512erintrin.h> directly; include <immintr341  avx512fintrin.h                      #error "Never use <avx512fintrin.h> directly; include <immintri895  dpapi.h                              missing binary operator before token "("             
Output as attached, perhaps a bit less complex than the original.

TimoVJL

#24
Bottle of red wine in saturday is always better than messing with gcc  :biggrin:

gcc == Global Chaos of Computing ?

Msvc and Pelles C have -e and -p options too.
May the source be with you

jj2007

Quote from: TimoVJL on February 25, 2024, 02:12:00 AMBottle of red wine in saturday is always better than messing with gcc

Gcc's -E option is interesting, because you get rid of all the #if WINVER... etc stuff.

HSE

Equations in Assembly: SmplMath

Biterider

Quote from: HSE on February 25, 2024, 02:31:11 AMCode Select Expand
gcc -malbec stdio.asm
A better option is "-Zinfandel". Try it out  :wink2:

Biterider

HSE

Equations in Assembly: SmplMath

Biterider

You know... good things are small  :thumbsup:

Biterider