Renaming DLL Functions?

- 1 answer

Is there a way for me to name my exported dll functions? When I use a dll export viewer the function names shown are the full declarations. I would like to use the JNA (JNI) to access functions inside the DLL, and the function names need to be a function name not a full declaration. If this is a duplicate please point it out!



It can actually be done with just the __declspec(dllexport) syntax (that is, without a .def file) if you declare the function as extern "C" (or implement it in a C file instead of C++).

extern "C"
  __declspec(dllexport) void __stdcall MyFunc(std::string &);

Generally much easier than exporting a mangled name with an alias (as you then need to track down the mangled name in order to assign an alias).