delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/11/16:00:22

From: Joey Lloyd <joey DOT lloyd AT me DOT gatech DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Compile C with ASM --- Help me.
Date: Fri, 11 Jun 1999 15:11:06 -0400
Organization: Georgia Institute of Technology, Atlanta GA, USA
Lines: 106
Message-ID: <37615F49.290D9E29@me.gatech.edu>
NNTP-Posting-Host: jlloyd.gtri.gatech.edu
Mime-Version: 1.0
X-Trace: news-int.gatech.edu 929128264 13309 130.207.208.22 (11 Jun 1999 19:11:04 GMT)
X-Complaints-To: usenet AT news DOT gatech DOT edu
NNTP-Posting-Date: 11 Jun 1999 19:11:04 GMT
X-Mailer: Mozilla 4.08 [en] (Win95; U)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

--------------6B1110CA55486B7D7CA03A33
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Below is a copy of an assembly and a C file that i am
trying to combine.  I am using NASM to assemble the
.ASM file and GCC to compile/make/link these files.
When I run GCC i get the following error message:

undefined reference to 'getvmode(void)'

What am I doing wrong?


--------------------- Filename: gvm.asm -------------------
------- Assembled using: nasm gvm.asm -fcoff -ogvm.o ------

                global _getvmode

                section .text

_getvmode:      mov ah,0x0f     ;get video mode
                int 0x10        ;call BIOS
                ret             ;Current video mode in AL

----------------------------------------------------------


--------------------- Filename: j.cc ---------------------
------- Compiled using: gcc j.cc gvm.o -o j.exe ----------


#include <stdio.h>

extern int getvmode();

int main()
{
        int i;

        i=getvmode();

        printf("Video Mode: %d\n",i);
}


----------------------------------------------------------

Thanks.

Joey Lloyd
jolloyd AT bellsouth DOT net



--------------6B1110CA55486B7D7CA03A33
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
Below is a copy of an assembly and a C file that i am
<BR>trying to combine.&nbsp; I am using NASM to assemble the
<BR>.ASM file and GCC to compile/make/link these files.
<BR>When I run GCC i get the following error message:
<P><B><TT>undefined reference to 'getvmode(void)'</TT></B>
<P>What am I doing wrong?
<BR>&nbsp;
<P><TT>--------------------- Filename: gvm.asm -------------------</TT>
<BR><TT>------- Assembled using: nasm gvm.asm -fcoff -ogvm.o ------</TT><TT></TT>
<P><B><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
global _getvmode</TT></B><B><TT></TT></B>
<P><B><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
section .text</TT></B><B><TT></TT></B>
<P><B><TT>_getvmode:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mov ah,0x0f&nbsp;&nbsp;&nbsp;&nbsp;
;get video mode</TT></B>
<BR><B><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
int 0x10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;call BIOS</TT></B>
<BR><B><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ret&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
;Current video mode in AL</TT></B><TT></TT>
<P><TT>----------------------------------------------------------</TT>
<BR><TT></TT>&nbsp;<TT></TT>
<P><TT>--------------------- Filename: j.cc ---------------------</TT>
<BR><TT>------- Compiled using: gcc j.cc gvm.o -o j.exe ----------</TT>
<BR><TT></TT>&nbsp;<TT></TT>
<P><B><TT>#include &lt;stdio.h></TT></B><B><TT></TT></B>
<P><B><TT>extern int getvmode();</TT></B><B><TT></TT></B>
<P><B><TT>int main()</TT></B>
<BR><B><TT>{</TT></B>
<BR><B><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int i;</TT></B><B><TT></TT></B>
<P><B><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i=getvmode();</TT></B><B><TT></TT></B>
<P><B><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("Video Mode:
%d\n",i);</TT></B>
<BR><B><TT>}</TT></B>
<BR><TT></TT>&nbsp;<TT></TT>
<P><TT>----------------------------------------------------------</TT><TT></TT>
<P>Thanks.
<P>Joey Lloyd
<BR>jolloyd AT bellsouth DOT net
<BR>&nbsp;
<BR>&nbsp;</HTML>

--------------6B1110CA55486B7D7CA03A33--

- Raw text -


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