delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/18/21:10:16

Message-Id: <199701190136.CAA21199@math.amu.edu.pl>
Comments: Authenticated sender is <grendel AT ananke DOT amu DOT edu DOT pl>
From: "Mark Habersack" <grendel AT ananke DOT amu DOT edu DOT pl>
Organization: What? (Poznan, Poland)
To: Matthew Mastracci <mmastrac AT acs DOT ucalgary DOT ca>, djgpp AT delorie DOT com
Date: Sun, 19 Jan 1997 02:48:11 +0100
MIME-Version: 1.0
Subject: Re: NASM w/DJGPP
Reply-to: grendel AT ananke DOT amu DOT edu DOT pl

Once upon a time (on 17 Jan 97 at 16:15) Matthew Mastracci said:

> C-definition: extern void greet(void)
> NASM-function: _greet__Fv
> 
> C-definition: extern int addfour(unsigned char, unsigned int, int, char)
> NASM-function: _addfour__FUcUiic
> 
> If you're ever in doubt, just check the compiled source to your program and
> see what the linker will look for.
> 
> BTW, to get the example program to work, just add "__Fv" to the ends of the
> functions in the assembler source.
> 
> Is there any way to change the linker's behavior (so it doesn't require
> these postfixes)?  
You are not in C mode! The function names above say that the source file was 
compiled as C++ not C. The 'postfixes' are called name mangling and aid C++ 
compilers in much stricter prototype checking (also enable you to create 
functions with default parameters and two or more functions with the same 
name provided that they take different parameters). I suspect that you 
compiled the source with the command line similar to the following:

  gcc [switches] source.C -o source.o

this tells djgpp/gcc that the source file is C++ not C - djgpp/gcc *is case 
sensitive* both in parameter names and in file extensions (the same applies 
to other GNU tools).
A quick guide to extensions:

  .c        - C code
  .C        - C++ code
  .cxx      - C++ code
  .cc       - C++ code
  .s        - assembler code with no pre-processor directives
  .S        - assembler code that has to be pre-processed prior to compile

These are only few of the extensions supported, but they give you an 
overwiev.

_http://ananke.amu.edu.pl/~grendel_________________________
The more I see, the more I hear, the more I find fewer
answers. I close my mind, I shut it out but you know it's
getting harder to calm down, to reason out, to come to terms
with what it's all about! I'm uptight, can't sleep at night
I can't pretend everything's alright! My ideals, my sanity
they seem to be deserting me but to stand up and fight I know
we have six million reasons!

- Raw text -


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