This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
AW: c++ symbol name
- From: "Kaul, Martin" <martin dot kaul at leuze dot de>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Tue, 29 Mar 2005 10:36:12 +0200
- Subject: AW: c++ symbol name
> Von: gcc-help-owner@gcc.gnu.org [mailto:gcc-help-owner@gcc.gnu.org]Im
>
> Hello,
> I need to define a specific symbol name for a function in the
> resulting
> object file. example:
>
> test.cpp:
>
> int test();
>
> int test()
> {
> //do something
> return 0;
> }
>
[...]
>
> So here comes my question. How can I define the symbol name for the
> test() function for example to _test?
This sounds like you want to mix C++ and C Code. If you only want to rename test() to be able to call test from a C-Modul then you can put the declaration of test() into an extern "C" block. Then the C++ compiler knows that he have to use the C-naming convention.
extern "C"
{
int test();
}
int test()
{
//do something
return 0;
}
Using code above test() internal will be named to _test.
regards
Martin