delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/09/21/19:23:55

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Tony Richardson <ar63 AT evansville DOT edu>
Subject: Re: Linking Assembly Code - Can't resolve printf
Date: Thu, 21 Sep 2006 23:23:20 +0000 (UTC)
Lines: 42
Message-ID: <loom.20060922T010620-604@post.gmane.org>
References: <OF434CE381 DOT D160E5BF-ONC12571EF DOT 0029097F-C12571EF DOT 0029288B AT onevision DOT de> <002701c6dc89$927b1d10$6cc027a0 AT davidiandesktop>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

David Lariviere <dal2103 <at> columbia.edu> writes:
> 
> Hi Kai,
> 
> Thank you so much. That got it compiling. I had tried it before, being
> inspired by the results of objdump on libc.a, but it didn't work at that
> point because I hadn't yet read about the importance of ordering the -lc
> after the object. I hadn't gone back and tried it since making that change,
> until your suggestion. Thanks!!
> 
> The code is actually taken out of "Professional Assembly Language" by
> Richard Blum.
> 

It is an entry point problem.  The easy way to get around is to
write a C main program that calls an asm_main.

I taught an assembly language course that used the above book as
the course text and Cygwin for the programming environment.  95% of
the material in the book works under Cygwin as well as Linux.

I created a library that contained code that worked around the
entry point problem and provided wrappers around the stdio routines.
(The students had programmed in C++ and had never used printf/scanf
and I wanted to get them started with I/O as quickly as possible.)

Anyway the lecture notes and the library source code are online at
http://csserver.evansville.edu/~richardson/courseware/CS220/spring2006/
Look for the CS220 Library and User's Manual about 1/2 down the
page.  The User's Manual lists example assembly code that will get
you started.

The example code you included in your post is used as an example
in Lecture 19: Getting Starting (it is the third assembly language
lecture, the first two cover X86 history and architecture - the
first half of the course covers digital logic) on slides 11 and 12.

I hope that you find the material useful in getting started with
Assembly under Cygwin.

Tony Richardson



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019