delorie.com/archives/browse.cgi   search  
Mail Archives: opendos/2001/06/15/13:32:41

Message-ID: <001101c0f5c1$084c8660$d822993e@i4n6v6>
From: "Enrico Bartky" <info AT realdos DOT de>
To: <fd-dev AT topica DOT com>, <opendos AT delorie DOT com>
Subject: DJGPP
Date: Fri, 15 Jun 2001 19:31:36 +0200
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Reply-To: opendos AT delorie DOT com

This is a multi-part message in MIME format.

------=_NextPart_000_000E_01C0F5D1.CB0BEBE0
Content-Type: text/plain;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

Hello,

I use DJGPP 2 and try to compile and assmble to object files and =
generate the program:

test1.S:

...
.global _TestFunction
.align 4
_TestFunction: pushl %ebp
/* some stuff */
ret


test2.c

extern int TestFunction(int nr1);

void main()
{
  ...
  TestFunction(4711);
  ...
}


I compile it:

gcc -c test1.S -o test1.o
gcc -c test2.c -o test2.o

ar rs all.a test1.o test2.o

gcc -o testprogram.exe all.a

but the link gives a undefined referenced TestFunction(int)! Can you =
help me?

------=_NextPart_000_000E_01C0F5D1.CB0BEBE0
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hello,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I use DJGPP 2 and try to compile and =
assmble to=20
object files and generate the program:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>test1.S:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.global _TestFunction</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>.align 4</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>_TestFunction: pushl %ebp</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>/* some stuff */</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ret</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>test2.c</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>extern int TestFunction(int =
nr1);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>void main()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>{</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; ...</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;TestFunction(4711);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp; ...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I compile it:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>gcc -c test1.S -o test1.o</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>gcc -c test2.c -o test2.o</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>ar rs all.a test1.o =
test2.o</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>gcc -o testprogram.exe =
all.a</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>but the&nbsp;link&nbsp;gives a =
undefined referenced=20
TestFunction(int)! Can you help me?</FONT></DIV></BODY></HTML>

------=_NextPart_000_000E_01C0F5D1.CB0BEBE0--

- Raw text -


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