Is there a way to suppress c++ name mangling?

Ohad Horesh picture Ohad Horesh · May 23, 2009 · Viewed 9.3k times · Source

I have a DLL that is written in C++ and I want to suppress the name mangling for a few exported methods. The methods are global and are not members of any class. Is there a way to achieve this?

BTW: I'm using VS2008.

Answer

bradtgmurray picture bradtgmurray · May 23, 2009

Surround the function definitions with extern "C" {}

extern "C" {
    void foo() {}
}

See http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html