Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: reasoner on November 09, 2007, 06:31:41 pm

Title: how to customize the functions name in dll
Post by: reasoner on November 09, 2007, 06:31:41 pm
under ms windows xp
i built a simplest dll file with C::B, which has only one ex funtion "SomeFunction".
after building, i got a .dll file and a .def file.
the content of the .def file:

EXPORTS
    _Z12SomeFunctionPKc @1

_Z12SomeFunctionPKc is the function name of "SomeFunction" in the dll.
how can i customise the function name? for example i would like name it just as "SomeFunction".

THANK YOU VERY MUCH.
Title: Re: how to customize the functions name in dll
Post by: Ceniza on November 09, 2007, 09:27:25 pm
The function name becomes like that because of Name mangling, which is something C++ does. If you want to remove all of that then you must compile it as C code, or use extern "C" in C++ code.