__declspec(dllexport) int __stdcall TestFunktion(void) { return 0; }
The result looks like this:

Is there any easy way to create the functions without decoration without DEF file in Visual Studio?
The standard approach to this problem is to define your export's undecorated name in a .def file - and this is the approach you should use.
But if for whatever reason you don't want to use a .def file, you can write code like:
__declspec(dllexport) int __stdcall TestFunktion(void)
{
#pragma comment(linker, "/EXPORT:" __FUNCTION__ "=" __FUNCDNAME__)
...
}
__FUNCDNAME__ will evaluate to your decorated function name, while __FUNCTION__ will evaluate to your undecorated function name - this is effectively a replacement for the equivalent line in the .def file.
As for your other question:
If I have a DLL file...how can I see functions are built as __stdcall or __cdecl?
this is not strictly possible from the DLL alone, much less if you deliberately omit hints from the export table (i.e. you might be able to see a decorated export symbol and infer that it's __stdcall, but you're choosing to export them as undecorated symbols) - perhaps if you perform some sort of analysis on the function's disassembly and try to understand its calling convention, but this is non-hermetic and very hacky.
This is why well-documented calling conventions and well-documented API signatures are important.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With