Seyran Avanesyan wrote: > Hi, Please don't hijack threads; start a new thread. Changing the subject line does not accomplish this. The mailing list archives on the gcc website and any threaded email client will show your message as a reply in a completely unrelated thread. > Is there any way to make exported function names unmangled without using > extern "C"? > > I'm compiling c++ file to a dll. Exported functions doesn't have extern > "C" specified for them, so their names got mangled. > The file cannot be edited. > > gcc -x c++ source.cpp -o source.o > gcc -shared -o source.dll other_source.o source.o > > If I put required names into .def file but compile as c++ file, because > of mangling I got errors: "Can not export ZZZZ: symbol not defined" The mangling is there for a reason. If you exported a function with C++ linkage but without its name mangled then it's very likely that you could call it from a compiler with a different C++ ABI, such as MSVC, and that would fail. Mangling prevents this, because it requires that to call the function you have a compiler with compatible ABI. If your complaint is simply that you don't want to put mangled names in the .def file, then I must ask: why use a .def file at all? It's usually not needed. The GNU linker has auto-export enabled by default which causes all symbols to be exported if __declspec(dllexport) is not used anywhere. And if __declspec(dllexport) is used, then the source itself already controls what functions to be exported so the .def file is extraneous. Brian