flat assembler
Message board for the users of flat assembler.
Index
> Windows > Why is the error "undefined symbol 'size?Ty'" generated? |
Author |
|
bitRAKE 21 Oct 2024, 15:11
It looks like your code is truncated - it's difficult to discern what is actually happening. I'm going to assume and show this complete menu resource as an example:
Code: menu main_menu menuitem '&File',0,MFR_POPUP menuitem '&New',IDM_NEW menuseparator menuitem 'E&xit',IDM_EXIT,MFR_END menuitem '&Help',0,MFR_POPUP + MFR_END menuitem '&About...',IDM_ABOUT,MFR_END _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
21 Oct 2024, 15:11 |
|
zvn 22 Oct 2024, 04:29
Quote: It looks like your code is truncated - it's difficult to discern what is actually happening. You are right. This code creates a window. Other controls behave normally. But the menu does not work. Quote: I'm going to assume and show this complete menu resource as an example: In my Win10 system, your menu compiles without errors, but after launching the menu does not appear in the window. Quote: every MFR_POPUP needs a corresponding MFR_END and a terminating MFR_END for the top-level menu bar. Yes, but the error occurs in the menu macro, not in the menuitem macro... Any other thoughts on this?
|
||||||||||
22 Oct 2024, 04:29 |
|
macomics 22 Oct 2024, 05:30
zvn wrote: Yes, but the error occurs in the menu macro, not in the menuitem macro... To make menu appear, it is not enough to simply declare it. It should also be added to the dialog. |
|||
22 Oct 2024, 05:30 |
|
zvn 22 Oct 2024, 05:47
Quote: Is it really a matter? If you do not have a macro call that will have to declare the missing variable, then you will get an error exactly at the place where the undeclared variable is used (in another macro or even module). What do you mean there is no macro call? And what do you think this code does? Code: macro main_menu In the resource.inc. file, the menu macro is described like this: Code: macro menu label { local data,size label dd RVA data, size, 0, 0 data dw 1,4,0,0 menu_size equ size = $ - data menu_level = 1 } In the programmer's guide, item 3.1.8, it says that the menu macro takes one parameter. What causes an error in my code? Quote: To make menu appear, it is not enough to simply declare it. It should also be added to the dialog. This may solve the problem of displaying the menu in the window, but how to do it? |
|||
22 Oct 2024, 05:47 |
|
macomics 22 Oct 2024, 07:24
zvn wrote: What do you mean there is no macro call? And what do you think this code does? Code: macro main_menu ; Declares a new macro named main_menu zvn wrote: In the resource.inc. file, the menu macro is described like this: Code: macro menuitem string,id,resinfo,status,type { dd MFT_STRING or type+0,status+0,id dw resinfo+0 du string,0 align 4 if ~ resinfo eq if resinfo and MFR_END menu_level = menu_level - 1 end if if resinfo and MFR_POPUP menu_level = menu_level + 1 dd 0 end if end if if menu_level = 0 menu_size ; And it's only here that constant size, defined in the menu macro, gets its numerical equivalent so that it can be substituted when using end if } zvn wrote: This may solve the problem of displaying the menu in the window, but how to do it? Code: ; x86_64 WM_INITDIALOG: invoke GetModuleHandleA, NULL invoke LoadMenuA, rax, RT_MENU invoke SetMenu, [hWnd], rax ... Code: ; i386 WM_INITDIALOG: invoke GetModuleHandleA, NULL invoke LoadMenuA, eax, RT_MENU invoke SetMenu, [hWnd], eax ... |
|||
22 Oct 2024, 07:24 |
|
macomics 22 Oct 2024, 08:23
zvn wrote: What do you mean there is no macro call? Code: macro my_macro { display "first", 13, 10 } ; Declare a new macro named my_macro my_macro ; Call a macro named my_macro eg show "first" macro my_macro args& { ; Redeclared a macro named my_macro display "second." my_macro ; Call a macro named my_macro (first) * ; * This call will be executed only when the newly declared macro is called } my_macro ; Call a macro named my_macro (redeclared) eg show "second." and then "first" purge my_macro my_macro ; Call a macro named my_macro (first) eg show "first" Code: $ fasm my_macro.asm flat assembler version 1.73.32 (16384 kilobytes memory) first second.first first 1 passes, 0 bytes. |
|||
22 Oct 2024, 08:23 |
|
zvn 22 Oct 2024, 09:29
Thanks guys! This is an example of menu resources:
Code: menu main_menu menuitem '&File',0,MFR_POPUP menuitem '&New',IDM_NEW menuseparator menuitem 'E&xit',IDM_EXIT,MFR_END menuitem '&Help',0,MFR_POPUP + MFR_END menuitem '&About...',IDM_ABOUT,MFR_END with calls to these functions: Code: invoke LoadMenuA, eax, RT_MENU invoke SetMenu, [hWnd], eax solved my problem! There is only one question left about this line: Code: label dd RVA data, size, 0, 0 It is clear that the label is created on an array of elements of size dd, but what does RVA mean? Quote: macomics Thank you, this was a fun experiment! You opened up the display command for me! |
|||
22 Oct 2024, 09:29 |
|
macomics 22 Oct 2024, 09:40
zvn wrote: It is clear that the label is created on an array of elements of size dd, but what does RVA mean? RVA - Relative Virtual Address 2.4.2 Portable Executable wrote: The rva operator can be used inside the numerical expressions to obtain the RVA of the item addressed by the value it is applied to, that is the offset relative to the base of PE image. |
|||
22 Oct 2024, 09:40 |
|
zvn 22 Oct 2024, 10:51
Quote: label dd RVA data, size, 0, 0 That is, the address of the first element (data) of this array dd will somehow depend on the offset relative to the end of the PE structure? Or will the value of the first element (data) be somehow related to the offset? |
|||
22 Oct 2024, 10:51 |
|
macomics 22 Oct 2024, 11:01
zvn wrote: That is, the address of the first element (data) of this array dd will somehow depend on the offset relative to the end of the PE structure? |
|||
22 Oct 2024, 11:01 |
|
bitRAKE 22 Oct 2024, 14:04
Another option is to specify the menu ID in the dialog statement:
Code: dialog dialog_example,'In-Tale: Menu',0,0,256,128,\ WS_VISIBLE or WS_CAPTION or WS_POPUP or WS_SYSMENU or DS_CENTERMOUSE,\ WS_EX_TOOLWINDOW,IDM_MULTI,'Segoe UI',11 ; nothing enddialog (Making everything static is very limited though.) _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
22 Oct 2024, 14:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.