.globl _returnfive _returnfive: push ebp mov ebp, esp mov eax, 0x5 pop ebp ret .section .drectve .ascii " -export:\"returnfive\""
Looking into asm code generated by GCC, we can clearly see, that function generated with __declspec(dllexport) has an additional section called drectv, just under it's body:
.section .drectve .ascii " -export:\"returnfive\""
Which is added specifically for the linker, so pointed function can be included in the export table.
Of course, function name depends on the case. Changing call convention, adding function arguments (if using __stdcall), function decorations in C++, etc. so we have to type the proper function name as the export symbol.
Below you can find the source code for that method: