Is there any way to manually decorate function names in MS C++? I’m going to guess any solution would be Microsoft-specific, and I’m cool with that.
Alternatively, is there a way to declare the function ‘??_M@YGXPAXIHP6EX0@Z@Z‘ so the compiler can understand it? FYI, undname lists it as:
void _ _ stdcall `eh vector destructor iterator'(void * , unsigned int, int, void (_ _thiscall * )(void * ))
Obviously, the compiler is not happy with apostrophes in my identifers.
EDIT:
The solution was actually extremely simple. I complied the obj’s, and hexedited the desired decorated names right over my placeholder names, padding them with nulls. The linker ate it right up, no questions asked. The functions are stubs, calling external functions so I don’t have to keep hexediting every time I make a small change.
Thanks for the ideas everyone.
If you declare your function as extern ‘C’ and use the linker option that disables underscore prefix, the name you give in the code is the name you’ll have in the .obj file. But this won’t solve all your problems, since the compiler will balk when you try to declare a function with special characters in the name.
I guess the solution (which is a lot of work IMO) is to give to the desired functions unique names in the source code (like PLACEHOLDER_01) and then replace these in the .obj file. You’ll need somehow to parse the object file and change the symbol names.
Notice also that `eh vector destructor iterator’ is a mangled name, the real (symbol) name shouldn’t have apostrophes or spaces in it. When dumping the .obj/.dll, you’ll have to disable name-mangling.