Date: 2009dec25
Language: C/C++
OS: Windows
Platform: MSVC++
Q. How can I export a symbol (like a function name) from a DLL without
a leading underscore in Visual Studio?
A. And as far as I know the only way to do this is. Write your
function like this:
extern "C" void _stdcall MyFunction(int param1, int param2)
{
// Body of your function goes here as usual.
// No need for declaration in a header file.
// Does not have to be type "void".
// Can be "BOOL" or any simple type.
}
Add its name to your .def file:
EXPORTS
MyFunction
This will export your function undecorated and without and underscore.
Just as the Windows API function are.
I tried __declspec(dllexport) and other things but they always added
a leading underscore or something.
| What this info useful to you? You can donate to say thanks |
Add a comment
Sign in to add a comment