-
July 11th, 2013, 11:18 PM
#1
Question on name mangling?
How come sometimes I don't use declarations like extern "C", the Visual C++ compiler doesn't complain about a C++ method calling a C function? Is it because of variant compilers? because I've got name mangling problem when using mingw64 on the same set of source code.
Thanks
Jack
Last edited by lucky6969b; July 11th, 2013 at 11:28 PM.
-
July 12th, 2013, 09:10 AM
#2
Re: Question on name mangling?
Originally Posted by lucky6969b
How come sometimes I don't use declarations like extern "C", the Visual C++ compiler doesn't complain about a C++ method calling a C function?
Maybe because the function is a C++ function that you're calling, and not a 'C' function?
If you don't use extern "C", the function will be regarded as a C++ function, regardless of how "C-ish" the function looks internally. So why should the compiler complain? Not using extern "C" means that the function can be overloaded, thus some name mangling scheme is used by the compiler to allow the linker to disambiguate functions that share the same name but have a different signature.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|