Page 1 of 2
MSVCP140.dll is valid error
Posted: Thu Sep 05, 2024 12:34 pm
by rfresh737
New PB user here. Trying to run my first simple program on my windows 10 PC and am getting this dialog message on start up:
"MSVCP140.dll is valid, but is for machine type other than current machine."
How do I fix this?
Thank you...
Re: MSVCP140.dll is valid error
Posted: Thu Sep 05, 2024 12:48 pm
by Fred
Which PB version do you use (x86, x64) ? Does the IDE launch ?
Re: MSVCP140.dll is valid error
Posted: Thu Sep 05, 2024 2:10 pm
by jacdelad
What is your first simple program?
Re: MSVCP140.dll is valid error
Posted: Thu Sep 05, 2024 4:44 pm
by rfresh737
I was just using the form builder and bringing up a blank window form.
Re: MSVCP140.dll is valid error
Posted: Thu Sep 05, 2024 4:45 pm
by rfresh737
Yes, the IDE launches fine. x64 Windows 10.
Re: MSVCP140.dll is valid error
Posted: Fri Sep 06, 2024 10:26 am
by rfresh737
It looks like this is really a FAsm.exe 'machine type' mis-match error. Is there some place where I can change my machine type for FAsm.exe?
Re: MSVCP140.dll is valid error
Posted: Fri Sep 06, 2024 10:30 am
by Fred
May be an antivirus issue. Why do you think it could be fasm ?
Re: MSVCP140.dll is valid error
Posted: Fri Sep 06, 2024 11:58 am
by rfresh737
I'm re-reading the dialog error again (below) and it's not FAsm.exe. It's a machine type mis-match within the 140.dll file. So does that mean the 140.dll file that I have for my windows 10 is a 32 bit version but I'm using a 64 bit windows 10 version?
(I turned off my anti-virus and it made no difference).

Re: MSVCP140.dll is valid error
Posted: Fri Sep 06, 2024 1:55 pm
by Fred
Hum, FASM doesn't depends of MVCP140.dll but lld-link does. I have compiled another version of lld-link for PureBasic x64 without these dependencies dans also much smaller, could you give it a try ? (you need to replace it in the PureBasic\Compilers\ dir)
https://www.purebasic.com/beta/windows_x64/lld-link.exe
Re: MSVCP140.dll is valid error
Posted: Fri Sep 06, 2024 11:37 pm
by rfresh737
I copied that file into PureBasic/Compilers folder and ran one of the example programs and got the same error dialog

Re: MSVCP140.dll is valid error
Posted: Sat Sep 07, 2024 4:21 am
by rfresh737
Doesn't that dialog message mean I have the wrong 140.dll file for my 64bit CPU?
Re: MSVCP140.dll is valid error
Posted: Sat Sep 07, 2024 8:21 am
by Fred
We ship the correct version with the PB package, could you upload your DLL somewhere to see if it's the x86 version?
Re: MSVCP140.dll is valid error
Posted: Sat Sep 07, 2024 9:08 am
by rfresh737
So the .dll should be the x86 version?
Where do I upload the file to and how do I check if its x86?
Re: MSVCP140.dll is valid error
Posted: Sat Sep 07, 2024 9:44 am
by rfresh737
I checked the 140.dll file in the PureBasic\compilers folder and it's a 64 bit file.

Re: MSVCP140.dll is valid error
Posted: Sat Sep 07, 2024 12:04 pm
by ChrisR
Fred wrote: Fri Sep 06, 2024 1:55 pm
Hum, FASM doesn't depends of MVCP140.dll but lld-link does. I have compiled another version of lld-link for PureBasic x64 without these dependencies dans also much smaller, could you give it a try ? (you need to replace it in the PureBasic\Compilers\ dir)
I tested the new lld-link and followed it up with procmon.
It does the job and looks very good
Really Much lighter (30 vs 84 Mb) and without the dependencies to msvcp140.dll, vcruntime140.dll, vcruntime140_1.dll
With this new version,I had no problems before with msvcp140.dll, but there shouldn't be any now, msvcp140.dll is no longer used at all.
The 3 dlls in the Compilers folder can be deleted (saved)