This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Re: Linker: Bug or Feature?


Hi! you wrote:

>>

>>Explanation
>>In asm or .c file if you defined a function whose protype is:
>>   int foofunc(int x);
>>This will create a function with linkage signature "_foofunc"
>>If you create the same function prototype but compile it with a C++
compiler,
>>it will create a function with a linkage signature similar to
>>"?foofunc@@YAHH@Z" - this is called name mangling and is done partially
to
>>ensure that the correction function get's called for the correct
parameter
>>types since you can overload different functions with the same name.
Okay, that makes this "bug" a "feature". I now understand what the name
mangling is for :-)
But then: How can I overload external assembler functions? Since the name
mangling differs from compiler to compiler, what can I do to maintain
portability?

>>To make it possible to call the c/asm function from c++, you must declare
the
>>prototype like this for C++:
>>   extern "C" int foofunc(int x);

THANK YOU!
This helps....

One more question: Given an "int i", I always thought "i++" or "i--" was
c++ only, but "i=i+1" or "i=i-1" was c and c++. Since I always use "i++" in
my loops, doesn't this make my code c++ automatically? So what does the
c-compiler do with this?

(don't beat me if I got something terribly wrong here........I read that in
a C++ book five years ago.)



Anyway, thaks for the numerous replies - they really helped.


Thakfully,
 Moritz


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]