Setting target platform on the command line in vc++ 2010 - visual-c++

I've been Googling around but without any luck. Can anyone tell me how to set the target platform to x86 only rather than any CPU, on the command line for Vc++ 2010? I am using Code::Blocks and it doesn't present this option in the gui from what I can see because it doesn't seem to know about vc++ 2010. The highest it goes is 2008, at least in my version.

Related

Can I compile old Excel COM Add-in code written in VB6.0 to work in 64-bit Excel?

I have code for an excel add-in I wrote over 20 years ago that I find myself needing again. It works fine in Windows XP and Excel 2003 in a virtualbox. In the VB6.0 IDE, I can load the code and make the dll which I can register as an excel add-in and use it in Excel 2003 within the virtual box. I can also use the VB6 IDE to debug it. I am looking to do the minimum to rewrite this for a short-term need to share with a small set of people in an organization using a current 64 bit version of Excel. They are in a locked-down environment so having them all run an old 32 bit version of Excel for this functionality is not an option.
Is there a version of Visual Basic which allows compiling for 64bit? I find references to what sounds like a VB7 IDE that would allow this. If it does exist, is it possible to get ahold of that anywhere? And will it actually make an add-in that will work with a current 64-bit version of Excel?
You can set registry entries to allow x64 to load x32 libraries.
So COM ignores bitness in EXE files. So any EXE file can be loaded by any COM client (and vice versa though no one cares). By setting registry entries you force your DLL into DLLHOST.exe.
COM loads a 64 bit stub into Excel and communicates to the stub. As far as Excel can tell it has loaded a 64 bit dll.
One problem is that one registry key you don't have permission to change. You must take ownership and give yourself permission to add an entry. There is no inbuilt tool to do this automatically, unlike for files.
This following reg file enables the MSScript Control, which allows you to execute VBScript and JScript as macro languages. Microsoft wants to kill VBScript and JScript and MS Script Control. So it is only available as a 32 bit dll for compatibility. It takes under a minute to add macro languages to any program. Contrast to VBA which you have to pay to use. Note the one line that requires TakeOwnership.
Windows Registry Editor Version 5.00
;MSScript.reg
[HKEY_CURRENT_USER\SOFTWARE\Classes\CLSID\{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}]
#="ScriptControl Object"
"AppID"="{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}"
[HKEY_CURRENT_USER\SOFTWARE\Classes\Wow6432Node\CLSID\{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}]
#="ScriptControl Object"
"AppID"="{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}"
;This one needs to be done manually
[HKEY_CURRENT_USER\SOFTWARE\Classes\Wow6432Node\AppID\{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}]
"DllSurrogate"=""
[HKEY_CURRENT_USER\SOFTWARE\Classes\AppID\{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}]
"DllSurrogate"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}]
#="ScriptControl Object"
"AppID"="{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}]
#="ScriptControl Object"
"AppID"="{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\AppID\{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}]
"DllSurrogate"=""
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AppID\{0E59F1D5-1FBE-11D0-8FF2-00A0D10038BC}]
"DllSurrogate"=""
The reference is here but only DLLSurrogate is of interest to you - https://learn.microsoft.com/en-us/windows/win32/com/appid-key.
A more of a background reference - https://learn.microsoft.com/en-us/windows/win32/winprog64/process-interoperability.

.xll Add-in isnt work without Visual Studio full version installed

UPDATE*
I made a excell addin (.xll file), with some math functions, compiled in c++, and it works normally in my computer. Well, when i try send to other person, isnt work. Excel's show a message like the file is corrupted, and when we try open it, open a sheet with some codes/words/symbols
I've tried to find a solution, but to no avail. But I found out what's the really problem.
After install Visual Studio (full version) in this machine wasn't working, the xll addin works!
So, I think I have a program, feature, component that I installed together with the visual studio (full version) that made the program run. I tried the SDK but was unsuccessful.
Could you help me please? I attached 3 images, one with the addin working and 2 with erros.
PS: i tried compiling version 32 bits and x64, for both excells, and happens in both excels (32 & 64 bits)
erro 1
erro 2
working
A colleague ask me to uptdate with the results of -dumpbin /dependents Addin.xll
Follow bellow:
File Type: DLL
Image has the following dependencies:
KERNEL32.dll
USER32.dll
MSVCP140D.dll
VCRUNTIME140_1D.dll
VCRUNTIME140D.dll
ucrtbased.dll
Summary
1000 .00cfg
3000 .data
4000 .idata
1000 .msvcjmc
A000 .pdata
29000 .rdata
2000 .reloc
1000 .rsrc
70000 .text
32000 .textbss
1000 .tls
1) Make sure what you send out to other persons are release builds, not debug ones.
2) Users who do not have the VC++ runtimes installed already will need to install the appropriate x86 (32-bit) or x64 (64-bit) redistributables from The latest supported Visual C++ downloads page (where the bitness depends on which x86 vs. x64 version of the XLL you send them, not on the bitness of their Windows installation).
MSVCP140D.dll
VCRUNTIME140_1D.dll
VCRUNTIME140D.dll
ucrtbased.dll
The 'D' suffix in those DLL names stands for "Debug". Those are the debug C/C++ runtime DLLs, which are used by the Configuration = Debug builds, and are installed as part of the Visual Studio setup. They are to be used during development, but not otherwise deployed, per Determining Which DLLs to Redistribute:
Debug versions of applications and the various Visual C++ debug DLLs are not redistributable.

Platform Toolset change on VS 2015

I need to do some Assembly coding on VS 2015 and for it I need to use an include file that uses certain C functions. The file worked perfectly on VS 2012 and 2013, but due to some library changes on VS 2015 (as far as I understand), it gives an error on the linking process. So, I was advised to set my Platform Toolset back to VS 2012 or lower, but the only ones that appear on the changing menu are the 2015 ones. I tried to download and install the said toolkits, but even then they don't appear in the drop-out menu. Is there something I'm doing wrong, or is there another way to do this? (eg. an include file with basic print and _getch functions that works on VS 2015) Here is a screenshot of the Toolset selection screen, if it helps:

Visual Studio 2012 - Locals not shown

I am using Visual Studio 2012 with the Intel Fortran Compiler XE 13.0 (from Parallel Studio 2013) to code in Fortran.
When debugging a project, the "Locals" and "Auto" windows don't show any variable. Similarly, when hovering over a variable name in the code, I don't get any datatip showing its value. Lastly, when trying to evaluate a variable or expression in the Watches I always get an "Unable to evaluate expression". So, as far as I understand, there's some problem involving debugger symbols or something like this.
Here's what I tried:
restarting VS and Windows
creating a new solution with default configuration
checking the Debugging options for any obvious setting which could case this
followed this answer, even if it looks like it's for a slightly different problem (VS recognizes a local variable, but saying it's out of scope)
repairing my Intel Parallel Studio XE 2013 installation
I never enabled optimization. Here's a screenshot so that you can clearly see what it's going on here.
P.S: as a last hint, I found a similar bug affecting VS2010, but 1) yeah, I've got VS2012 and I suppose it should have been fixed 2) it affects C++ (don't know if this matters though) 3) the patch is not directly available online.

How to compile C code for an Excel XLL in Visual Studio 2008 so it runs on Office 2010 64 bit version

I have an Excel add-in that I developed using Excel 2007 SDK, it works fine on Excel 2007 and Excel 2010 32 bit version
More recently I noticed that Office 2010 or Excel 2010 is also made available as 64bit software as compared to 32 bit version in Excel 2007 and its counterpart in Excel 2010
I understand it would require Excel 2010 SDK and Visual Studio 2008 to be able to compile the XLL as a 64bit version so it will run in Excel 2010 64 bit on Win7
Are there any specific options I need to set in Visual Studio 2008 so that I can compile the code as 64 bit version
I looked at the sample code in Excel 2010 SDK and it uses the same XLOPER12 data type and the example code looks quite like the one for samples in Excel 2007 SDK
This leads to me ask whether the code from the previous version would require any changes before it is to run in a 64bit Excel environment
Many Thanks in Advance
If your code compiles - you should be good to go. That said - if you are doing any pointer arithematic with the XLOPER12s - you will of course need to keep in mind pointers are 8 bytes in a 64 bit build.
Also - if you are dynamically linking to the CRT make sure you provide the redistributable. Alternatively - statically link to the 64 bit crt.
You don't have to do anything special to get your code to work. Have a look at http://xll.codeplex.com if you want an easy way to create add-ins.

Resources