-
March 30th, 2020, 11:04 AM
#1
A nice surprise (re: name-mangling)
I might be wrong about this - but in earlier versions of Visual C++ I've a recollection that it wasn't possible to "mix + match" between different compiler versions. So if you compiled something with VC++12, you could link it to a 'C' library from (say) VC++8 or VC++9 - but you couldn't do the same for C++ libraries (because each compiler used different name-mangling schemes).
However... I just built a test project using VS2019 (VC++14) and I was surprised to find that I can link it to libraries that were written back in VC++8. Is that a happy accident - or something that Microsoft fixed at some point?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
March 30th, 2020, 11:28 AM
#2
Re: A nice surprise (re: name-mangling)
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
March 31st, 2020, 05:37 AM
#3
Re: A nice surprise (re: name-mangling)
It's great to hear that MS have fixed this but I must admit, I'm confused... If I'm reading the article correctly it implies that VS2015, 2017 and 2019 will now be compatible with each other - but in my case, I built a DLL with VS2019 and managed to link it to some link libs from DLLs built with VS2005. I'm not complaining - it's great news!!! I have an enormous project here written with VS2005 and I've always been put off updating it because of the huge amount of work involved. But if I could update it in small steps, that'd really be useful
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
March 31st, 2020, 06:05 AM
#4
Re: A nice surprise (re: name-mangling)
The words mouth, horse and gift comes to mind!
I'm guessing - but I'd say that depending upon the interface, some VS2019 will link with versions earlier than VS2015 and some might not. Certainly there have been changes to the 'mangling' since VS2005. You might be lucky - or not.
Last edited by 2kaud; March 31st, 2020 at 06:08 AM.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
April 2nd, 2020, 11:03 AM
#5
Re: A nice surprise (re: name-mangling)
That reminds me... whatever happened to manifest files? In some earlier versions of VC++ it was necessary to include something called a manifest file at the link stage. IIRC this later told the OS which version of the CRT to use. But manifest files seem to have disappeared now - unless I'm missing something (or is this all implemented some other way now )
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
April 3rd, 2020, 03:48 PM
#6
Re: A nice surprise (re: name-mangling)
Originally Posted by John E
But manifest files seem to have disappeared now - unless I'm missing something (or is this all implemented some other way now )
When a Windows application is started not everything it needs to run is present inside the executable. The executable must bind to outside stuff that is described in the Manifest.
https://docs.microsoft.com/en-us/cpp...s?view=vs-2019
A Manifest must always be present but you don't have to bother with it much these days due to the increasing user-friendliness of VS. If you stick with ordinary MS technology the linker doesn't need any help to generate a Manifest for you.
I really appreciate VS and the C++ language but sometimes if find the increasing complexity and loss of control quite scary. That's when I regress back to simpler times and feel a strong urge to rewrite everything in C using Emacs.
Last edited by wolle; April 4th, 2020 at 10:58 AM.
-
April 6th, 2020, 06:34 AM
#7
Re: A nice surprise (re: name-mangling)
Originally Posted by John E
Is that a happy accident - or something that Microsoft fixed at some point?
Linking C++ code depends on presence of symbolic names. In its turn, the presence of the names that to be resolved depends on two factors. First, the scheme of name mangling, which is typically standardized for quite a long time within the same family of compilers. Second, the version of STL a compiler forces you to link with. And exactly the latter factor is the most unpredictable and poorly comprehensible thing nowadays and this is where your happy accident might really be.
Best regards,
Igor
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
|