flat assembler
Message board for the users of flat assembler.
Index
> Main > Convert C types to assembly |
Author |
|
vbVeryBeginner 16 Apr 2006, 19:08
hi patrick
if you take a look on your fasm installed directory, assume c:\fasm c:\fasm\include\EQUATES\WSOCK32.INC you would be able to see the following : Code: struct hostent h_name dd ? h_aliases dd ? h_addrtype dw ? h_length dw ? h_addr_list dd ? ends struct sockaddr_in sin_family dw ? sin_port dw ? sin_addr dd ? sin_zero db 8 dup (?) ends if possible, plez take a look on this example. http://flatassembler.net/examples/quetannon.zip Quetannon Demonstration of using WinSock library to make TCP/IP connections. Written by Tomasz Grysztar. |
|||
16 Apr 2006, 19:08 |
|
Patrick_ 16 Apr 2006, 21:39
Wow, thanks, I never thought to look in there. I will now.
|
|||
16 Apr 2006, 21:39 |
|
RedGhost 17 Apr 2006, 05:57
vbVeryBeginner wrote: hi patrick int would be dw on DOS int would be dd on windows XP don't know what OS this is for _________________ redghost.ca |
|||
17 Apr 2006, 05:57 |
|
UCM 17 Apr 2006, 12:59
its for Windows (all 32-bit versions)
if you do some research `short' always means 16 bits |
|||
17 Apr 2006, 12:59 |
|
vid 17 Apr 2006, 18:24
Code: printf("%d\n",sizeof(char)); printf("%d\n",sizeof(short)); printf("%d\n",sizeof(int)); printf("%d\n",sizeof(long)); printf("%d\n",sizeof(void*)); // all pointers are of same size, unless "far" operator is used |
|||
17 Apr 2006, 18:24 |
|
Patrick_ 18 Apr 2006, 21:45
vid: my problem wasn't with simple data types, such as int, long, char; it was with data-type declarations such as "char **var", "char *var[100]", etc.
|
|||
18 Apr 2006, 21:45 |
|
vid 18 Apr 2006, 22:33
pointer is always dword. o if you have (anything)* it is always dword, holding addres of that anything. For example char*, is dword holding addres of char, or int** is dword holding address of int*, which is dword holding address of int. (anything)[] is just the same as (anything)*, so you treat it same.
in C there is alot confusion with types, you'll have to get it by time. Code: ;char *a = "abcdefg"; ;char *b = "xyz"; a db "abcdeg",0 b db "xyz",0 ;char *c[2] = {a,b}; c dd a, b in short, in assembly you only know you have a dword value, but compiler doesn't know if it is number or pointer to something, and there also don't know what it is pointing to, it's up to you to handle it correct. In assembly only types are byte, word, dword etc. Less abstraction, like it or not :] |
|||
18 Apr 2006, 22:33 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.