Date: Sun, 26 Jan 1997 02:44:47 -0500 (EST) From: Michael Phelps To: nikki cc: djgpp AT delorie DOT com Subject: Re: dumb linking question In-Reply-To: <5ce42c$bhs@flex.uunet.pipex.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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