Using Visual Studio 2005, I wrote a simple DLL in C that uses the Windows API to send UDP datagrams and that is hooked into a third-party program. On a 64 bit machine, it does not work at all, as the third-party code was compiled for 64 bit in this case. So I need to ship two versions of the same DLL - one for 32 bit, one for 64 bit.
However, I did not manage to get Visual Studio (running on a 32 bit machine) to spit out a DLL that is not identical to the 32 bit version - it seems the 'machine' setting in the project properties is simply ignored. A colleague told me VS 2008 simply refuses to cross-compile in this scenario. Is this really not possible at all?
Right click the project in the Solution Explorer then go Properties / Configuration Manager / Active Solution platform: <New...> / x64 / OK / Close. Then select x64 in Platform, OK, and you're good to go.
Related
I am having trouble moving my WPF project from 32 bit to 64 bit. I recently realized I need my program to be able to use more than 2gb of memory.
What I did was I changed my project's platform target from Any CPU (with preferred 32 bit checked) to x64.
I then got an error stating “XXX” does not exist in the namespace “XXX" and realized it was probably because I did not change the CPU target for my other libraries.
Then when I launched the program in my developer machine, it works perfectly fine using both visual studio and Click Once installing after deploying. However, when I test the deployed executable using a few different 64 bit machine, the program starts behaving erratically with some functions not working properly.
I have no idea how to debug since it works perfectly fine in my developer machine but not on any other computer? Am I not changing the target platform correctly?
The assembly ITSELF built by youself when targeting "Any CPU", but you should check out every third-party assemblies that used in your project if they are targeting "x86". If you change the target of your own project to "x64", make sure all of the dependencies are for "Any CPU" or "x64".
I'm trying to find a solution to allow me to compile C code to a DOS executable from Windows 7 64-bit. I recently updated from XP 32-bit to Win7 64-bit, and now my Borland C++ 5.0 compiler won't work. I get an error when it tries to call tlink.exe 16-bit. I'm trying to avoid bringing over another computer with XP but that will have to be my course of action if I can't figure something else out soon.
My target is an embedded x86 running FreeDOS. As much as I'd like to transition to Linux I can't afford the time that would transition would take. Aside from the learning curve of never having used Linux, much of my code is DOS-dependent and would have to be re-written.
I'm hoping there's a windows setting I can just change but my research so far leads me to believe I need a more drastic change to my process. I've sniffed around at Turbo C 2.01, DJGPP, DOSbox... not really too confident to go down any of those alleys without some outside input
Run Virtual XP or VirtualBox and install Borland C++ inside. BTW, there is version 5.02 with some fixes (in case your version is exactly 5.0).
If you can find an old Microsoft Compiler, like 16 bit C / C++ 1.52 (which is included on the 32 bit C / C++ 4.1 cd-rom), or C 8.00 or earlier, it runs using a dos extender or in a 32 bit dos console window.
Why can't you run the Borland compiler using FreeDOS?
You could try to create a virtual machine with MSDOS on it, but you'd have to find a way to install MSDOS 6.22 on the virtual machine. At Microsoft's support site, they have links to a bootable ISO file for MSDOS 6.22. I still have the original floppies and started with those on an old system that has a floppy drive. It's a bit awkward to import / export files to / from the virtual machine.
This is the config.sys that I use that seems to work with Win 7 virtual machine. I had to increase buffers, stacks, and files to avoid a stack overflow problem with this setup.
dos=high,umb
buffers=40,0
files=60
lastdrive=e
shell=c:\command.com c:\ /e:1024 /p
stacks=64,512
switches=/f
device=c:\dos\himem.sys /numhandles:64 /testmem:off
device:c:\dos\emm683.exe ram i=b100-b7ff i=c600-c7ff i=cc00-cfff i=e600-efff frame=d000 a=32 d=128 notr
devicehigh=c:vmadd\cdrom.sys /d:mscd001
This is the autoexec.bat that I use (smartdrv is a bit pointless in this case so I commented it out with "rem" prefix) .
c:\dos\emm386 auto
lh c:\dos\mscdex.exe /d:mscd001 /m:7
rem lh c:\dos\smartdrv.exe
lh c:\vmadd\mouse.com
set path=c:\dos
set blaster=a220 i5 d1 h5 p330 t6
prompt $p$g
As for a compiler, Open Watcom seems to me to be the best choice in your situation. FrameworkPascal (written in the old version of Watcom) provides a 32 bit extender. Regarding the creation of a FreeDOS virtual machines, pickup the tools from Microsoft SysInteral. They include a tool that create a VHD. Once you get a FreeDOS running in a VM you can simply SYS the VHD and start it anywhere. There are plenty ready to run ISO images for FreeDOS, one worth mentioning is Seagate Seatools for DOS which is being distributed with the FreeDOS kernel.
Your best (but not only) solution for running all that is probably XPMode on Windows 7 Pro. It runs Windows XP 32 which of course provide 100 percent transparent compatibility via its NTVDM with DOS 16 bit real mode, 16 bits protected (Windows 3.1), and DOS 32 bit extenders.
NTVDM by the way is a feature that can be activated on Windows 10 Pro but it yet to be seen what exactly can be done with it there.
XPMode is a free downnload from Microsoft that installs a free version of Windows XP 32 bit in a virtual machine on Windows 7 Pro with full sharing of the cutpaste/copy buffer, USB, drives, screen and network card (web access). It can be toggled between a Window and full screen. The installation of XPMode is automated (after activation of the Windows 7 Pro VM). Microsoft provide various downloadable hot fixes that update the registry to activate the VM. There is an MS support downloadable hot fix that has to be run to allow the installation on the AMD Bulldozer architecture. XPMode hibernate its desktop and virtual hard drives making it a much more productive environment than a hardware based system.
With a little extra work Windows XP 32 bits can be installed on any virtual machine including Microsoft Virtual Machine on Windows XP 64 bits as well as Oracle Box and VMWare. XPMode however is probably the smoothest solution since some installations such as MS Virtual Machine for Windows XP 64 bits do not utilized the full physical display in full screen (only about 90 percent of it). If you install your browser and email in XPMode you can live in the full screen and forget about new versions of Windows.
I made an application, and i had to compile a 32bit and a 64bit version of it. I saw some application, like ProcessExplorer acting as follows. On 32bit OS it runs a 32bit app, but on a 64bit OS it extracts a 64bit version of the same exe and this will be executed. So how can i make such an application from my app? What settings should i make in Visual Studio?
Process explorer works like this:
You download a single 32 bit executable.
When you run that executable on a 32 bit OS, that's it.
When you run that executable on a 64 bit OS, the 32 bit process detects that on startup and to disk extracts a 64 bit executable that is stored as a resource in the 32 bit process. And then it runs that 64 bit executable.
There aren't any settings in Visual Studio that would automate that process for you. You'd have to write that part for yourself. You could have a build process that built the 64 bit version first. And then you could compile that executable into a resource which you link into your 32 bit process. Which is what you ship.
I myself am not convinced it's worth all the effort. Personally I'd be inclined to ship two different executables, but I guess only you know your own requirements.
Why not get the installation program to install the appropriate version depending on the OS and give that executable the same name for either OS?
I have a WPF app that uses Flash10c.ocx developed on a 32 bit machine. I didn't have to register the ocx on my dev machine, I just installed the latest flash, added a reference and started coding. When testing on a 64 bit system I get ye old "Class not registered" which I think mean I need to regsvr the ocx. Is it Ok to just copy the 32 bit ocx (I'm pretty sure its 32 bit as its located in C:\Windows\System32\Macromed on the dev system) to a 64 bit system and register it?
Update: regsvr32 /i flash10c.ocx errors out with "The module flash10c.ocx las loaded but the call to DllRegisterServer failed with error code 0x80004005"
Update 2: I've given up on this and decided to run Flash on 32 bit systems only. If anyone has a better answer I'd like to hear it but I'm marking the current suggestion as answered to give due credit for the effort.
The reason it's not working for you is that your WPF application is running as 64-bit.
A .NET application is able to run as 32-bit or 64-bit; and the CLR is JITing your app to whatever architecture the application is running on - in this case 64-bit.
Except you now want your 64-bit application to load a 32-bit dll. This is not possible. A 64-bit process can only load 64-bit dlls. A 32-bit process can only load 32-bit dlls. No amount of fiddling with COM object registration will change this; it's not a question of missing registry entries.
Adobe Flash only comes as a 32-bit dll. Adobe does not now (and hopefully will never) have a 64-bit version.
In order for your WPF .NET application to load the 32-bit flash dll, it needs to be running as 32-bit process. There is a way, in Visual Studio's build configuration, to force your .NET application to only target x86, rather than Any CPU.
The choices of CPU targets are:
Any CPU
x86
x64
Itanium
Flash, for what it's worth, doesn't have an Itanium version, either.
See StackOverflow: Visual Studio “Any CPU” target for more discussion about target cpus.
May be the flash installer is meant to be only for 32 bit OS. Hence it did not install properly on a 64 bit machine. The error means that you will need to manually register the ocx but will it register successfully that's a totally different question.
Edit 1: here is Adobe's statement of support for 64-bit systems (there is none) (I assume you are using 64 bit browser on a 64 bit machine)
Edit 2: Another forum message about Flash on 64-bit Windows.
For many years we have been using xp_pcre for regular expressions in sql server:
xp_pcre - Regular Expressions in T-SQL
I've just migrated to a new 64 bit vista development machine and have installed xp pcre. Unfortunately when i try to use the sprocs I get the following error: Could not load the DLL xp_pcre.dll, or one of the DLLs it references. Reason: 193(%1 is not a valid Win32 application.).
Has anyone had any success installing xp_pcre on a 64 bit machine running vista? Any advice? Thanks in advance,
Shane
Since it's a compiled DLL, you would probably have to recompile it to get a 64 bit DLL, that could be run on your 64 bit machine. Since nothing at that page has been updated since 2005, it's unlikely there is an already a prebuilt version for 64 bit. However, since the source code is included, you could, if you have VS for C++, with a 64 bit compiler, compile it yourself and try to get it working that way.