Mail Archives: djgpp/1997/01/18/21:10:16
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 -