delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/11/19:17:24

Sender: nate AT cartsys DOT com
Message-ID: <376198EE.5256D167@cartsys.com>
Date: Fri, 11 Jun 1999 16:17:02 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Compile C with ASM --- Help me.
References: <37615F49 DOT 290D9E29 AT me DOT gatech DOT edu>
Reply-To: djgpp AT delorie DOT com

Joey Lloyd wrote:
> 
> 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();

Try `extern "C" int getvmode();'

C++ normally uses name mangling; this will stop it.

And please don't post in HTML.
 
> int main()
> {
>         int i;
> 
>         i=getvmode();
> 
>         printf("Video Mode: %d\n",i);
> }
> 
> 
> ----------------------------------------------------------
> 
> Thanks.
> 
> Joey Lloyd
> jolloyd AT bellsouth DOT net
> 
> 

-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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