NASM Forum > Programming with NASM
nasm + lld-link
NASM:
Help me pls import function
--- Code: ---BITS 64
SECTION .bss
hSocket: resq 1
SECTION .data
port: equ 777
struc WSADATA
.wVersion: resw 1
.wHighVersion: resw 1
.szDescription: resb 256
.szSystemStatus: resb 256
.iMaxSockets: resd 1
.iMaxUdpDg: resd 1
.lpVendorInfo: resq 1
endstruc
struc sockaddr_in
.sin_family: resd 1
.sin_port: resd 1
.sin_addr: resq 1
.sin_zero: resb 8
.size:
endstruc
SECTION .text
global start
extern WSAStartup
extern WSACleanup
extern socket
extern Sleep
extern ExitProcess
import ExitProcess kernel32.dll
extern accept
extern listen
extern bind
start:
mov rdx , [WSADATA]
mov rcx , 0x202
call WSAStartup
mov r8 , 0
mov rdx , 1
mov rcx , 2
call socket
mov [hSocket] , rax
mov dword [sockaddr_in.sin_family] , 1
mov qword [sockaddr_in.sin_addr] , 0
mov ax , port
xchg ah , al
mov [sockaddr_in.sin_port] , ax
mov r8 , sockaddr_in.size
mov rdx , [sockaddr_in]
mov rcx , hSocket
call bind
mov rdx , 13
mov rcx , hSocket
call listen
mov r8 , 0
mov rdx , [sockaddr_in]
mov rcx , hSocket
call accept
mov rcx , 60000
call Sleep
call WSACleanup
mov rcx,0
call ExitProcess
--- End code ---
C:\msys64\home\Alexey>nasm cmd.asm -f win64 -o cmd.obj
cmd.asm:39: error: parser: instruction expected
https://wasm.in/threads/lld-bsd-exe.32375/#post-402921
fredericopissarra:
There is no "import" directive in NASM... All symbols resolution is made in linking phase...
NASM:
LLD BSD EXE
Wont write clear browser wif support MSHTML.DLL
WASM.IN FORUM
NASM:
I still do not understand how to import functions?
pexports C:\Windows\System32\user32.dll > user32.def
dlltool -d user32.def -l user32.lib
debs3759:
Import is not a processor directive, it is a macro that generates a series of commands, and it is not part of nasm. If you really need to use it, you will need MASM.
Navigation
[0] Message Index
[#] Next page
Go to full version