#206 new
Peter Johnson

windows+yasm+cygwin's ld

Reported by Peter Johnson | June 25th, 2011 @ 07:52 PM

Originally posted on Trac by nitnatsnok@xakep.ru
Original Trac Ticket

  Description

Help!!!
I'm trying to assemble the simplest program under windows. It should write string to console(using printf procedure from msvcrt.dll) and exit.
Code:

extern printf
extern ExitProcess
%define exit ExitProcess

section .text

push msg
call printf

push 0
call exit

section .data

msg   db  'Hello, world!', 13, 10, 0

It looks right, I think. Desn't it?
Next I compile it in win32 object file:
$ yasm -f win32 hello.asm and this command creates hello.obj file.
Next, I think, I should link it. I'm trying to do it like this:
$ ld -o hello.exe hello.obj and I see following:

hello.obj:hello.asm:(.text+0x6): undefined reference to `printf'
hello.obj:hello.asm:(.text+0xd): undefined reference to `ExitProcess'

I should say linker that my program takes these procedures from msvcrt.dll and kernel32.dll but I don't know how.. :(
Please, I need help.

PS. Please, don't advise me to use another linkers. I know how to link DLLs with them but I want to use ld only.

PSS. Sorry for my very very bad English :)

Trac Attachments

Trac Comments

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Yasm Modular Assembler Project

Shared Ticket Bins

People watching this ticket

Tags

Pages