[Question] is it possible to force wpp to the same name mangling as wcc? #843
-
wcc name mangling:
wpp name mangling:
is it possible to force wpp to also use the wcc style? (for all or better only this function thats gets used in assembler code) (future: __cdecl and __near gets removed when my reversing project is 100% ported C/C++ code and then the mangling is also not relevant anymore) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 9 replies
-
Are you sure that you understand what you are asking for? |
Beta Was this translation helpful? Give feedback.
-
in a every-C++-project context: this can produce evil name clashes due to overloading feature of C++ etc. in my local context yes - and im talking about decent free functions - for the asm/C++ interaction, garanteed differently named - not the complete program i ask different: i would like to use the wpp compiler for my reversing (because i hate to predefine my local variables in C and reversed code contains masses of them) over the time: partial routines in assembler, partially in C++ - temporary - until everything is ported and fully tested - in the end only C++ will survive - currently im doing that usually in C - but i want to try C++ for better readability if i use wcc i just write
in my assembler source but that failed with wpp (due to the C++ mangling) i've tried
but that gives an error with wlink but maybe its a just too special what im asking for |
Beta Was this translation helpful? Give feedback.
-
Generally on Assembly level you don't know what is C and what is C++ symbol. I am not sure but What linker show you is unmangled C++ symbol, if you want to see native symbol then use linker option |
Beta Was this translation helpful? Give feedback.
-
with
the name in the obj file is (with dmpobj.exe)
IDA Pro resolves it to (IDA directly supports omf/coff obj files)
so it could be a problem with |
Beta Was this translation helpful? Give feedback.
-
Isn't this what extern "C" is for? In your C++ code do:
The C++ compiler will not use C++ name mangling on such functions so they end up with names that are compatible with the names produced by the C compiler. Typically this is used for calling C functions from C++, but you can do this even for functions written in C++ to make them callable by C. However, calling C++ from C might be trickier because of the runtime library requirements. |
Beta Was this translation helpful? Give feedback.
Generally on Assembly level you don't know what is C and what is C++ symbol.
C++ symbols mangling is depend on used compiler against C where some rules are defined for cdecl.
But OW doesn't use cdecl as default therefore C names use mangling rules depend on calling convention which can be different symbol-by-symbol.
If you are sure C++ compiler was OW or Watcom then you can use demangling functions which is included in C run-time-library.
But you need to know which symbol is C++ and which is C.
I am not sure but
assembler has different character set
for symbol names then C or C++ language that you can have a problem with some symbol names. for such names you can use back quote against suc…