News:

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

Main Menu

GoAsm: Where to place struct definitions?

Started by traphunter, November 26, 2013, 03:22:17 AM

Previous topic - Next topic

traphunter

Hi all!

GoAsm.Exe Version 0.58.0.3

I tried to compile with command: GoAsm.exe /fo test.obj test.asm

<SOF>
;
   STRUCT addrinfo
      ai_flags         DD   ?   ;   int
      ai_family         DD   ?   ;   int
      ai_socktype      DD   ?   ;   int
      ai_protocol      DD   ?   ;   int
      ai_addrlen      DD   ?   ;   size_t
      ai_canonname   DD   ?   ;   pointer auf type <char>
      ai_addr            DD   ?   ;   pointer auf type <struct sockaddr>
      ai_next            DD   ?   ;   pointer auf type <struct addrinfo>
   ENDS
;
.Const

.Data

nimo addrinfo

.Code

start:

mov [nimo.ai_family], eax

ret
<EOF>


Error!
Line 2 of assembler source file (test.asm):-
Must declare a section first -
Use DATA SECTION ["name"], CODE SECTION ["name"] or CONST SECTION ["name"]
Or just DATA, CODE or CONST; .DATA, .CODE or .CONST

OBJ file not made


Ok, goasm did'nt work, but I saw some sample code like mine.
What's wrong? I am confused, I must missunderstanding some essential things. :(

Thank you for your helping me!
traphunter

dedndave

not too sure about GoAsm, but for Masm, you're almost correct
nimo addrinfo <>

if you choose not to initialize it, it can go in the .DATA? section
if you want to initialize the members, use the DATA section...
nimo addrinfo <1,2,3,4,5,6,7,8>

using a .CONST section is really a compiler thing
it adds another section to the PE file, and generally takes up more space
put the .CONST data in the .DATA section, and don't write to it   :P

traphunter

thank you dedndave, I tried <> ..., but it isn't the solution. GoAsm reports the error at Line 2 of assembler source file.

dedndave

oh ! - didn't see this, before...
  addrinfo STRUCT
      ai_flags         DD   ?   ;   int
      ai_family         DD   ?   ;   int
      ai_socktype      DD   ?   ;   int
      ai_protocol      DD   ?   ;   int
      ai_addrlen      DD   ?   ;   size_t
      ai_canonname   DD   ?   ;   pointer auf type <char>
      ai_addr            DD   ?   ;   pointer auf type <struct sockaddr>
      ai_next            DD   ?   ;   pointer auf type <struct addrinfo>
   addrinfo ENDS


notice the first and last lines

traphunter

oh my god, I spent several hours to find out what's my mistake. I put the definition in an inc file, in the data section, waste my time on google ... such a shame  :icon_redface:

thank you very much!

Vortex

Hi traphunter,

For your information, you can get the GoAsm headers from :

http://www.donkeysstable.com/goasm_headers.htm

Edgar's header file set contains the Windows structure definitions.

traphunter

Hi Vortex,

thank you for your information, but all header I've found define a different version of struct addrinfo, maybe an older version. The definition above is located in ws2tcpip.h and no assembler header collection I've found includes this header.

traphunter