delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/26/03:02:08

Date: Sun, 26 Jan 1997 02:44:47 -0500 (EST)
From: Michael Phelps <morphine AT hops DOT cs DOT jhu DOT edu>
To: nikki <nikki AT gameboutique DOT co>
cc: djgpp AT delorie DOT com
Subject: Re: dumb linking question
In-Reply-To: <5ce42c$bhs@flex.uunet.pipex.com>
Message-ID: <Pine.GSO.3.95.970126024120.2269A-100000@hops.cs.jhu.edu>
MIME-Version: 1.0

I don't quite understand what you're asking, but I'll take a shot at it...

On 25 Jan 1997, nikki wrote:

> ok, this must be something stupid i'm doing because i can't even find a reference to it in the faq :(
> i have 2 programs, one has a routine called wibble which is extern'd
> the other file consists of :
> 
> int wibble(void);

I'm assuming you mean "extern int wibble(void);" here (ie, this is the
main program file and the other file is the assembly source for wibble()).

> 
> void main() {
> 	printf("%d \n",wibble());
> }
> 
> when i try to compile this i get unresolved reference to wibble errors. :( from *both* pieces of code
> what on earth am i doing wrong? usually i would use extern int wibble(void); in this code and define the code in the other routine, but in this case the other routine is assembler and i don't know how to declare it as anything under nasm except [EXTERN wibble] so i somehow have to define it in this routine i guess...
> 
> regards,
> nik

My suggestion would be to assemble to wibble file to an object file (such
as "wibble.o".  Then compile and link in one command:

gcc -O2 myprog.c wibble.o -o wibble.exe

Either that or use inline asm in a wibble.c file and let gcc compile both.

> 
> 
> 
> 
> -- 
> Graham Tootell           GameBoutique Ltd. - THE online gaming experience
> nikki AT gameboutique DOT com   http://www.gameboutique.com
> 
> 


						---Michael Phelps
						   morphine AT cs DOT jhu DOT edu


                               CH3
                               |
                               N
                             / |
                     ______/   |
                    /      \   CH2
             _____/         \__|__      
           //     \\        /  |  \\     
         //        \\______/___CH2 \\  
          \        /       \       /
           \______/         \_____/
          / ------ \       /      \
        OH           \   /         OH
                       O
 
                   Morphine



- Raw text -


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