I developed a C# application that makes use of Congex vi开发者_C百科sion library (VPro). My application is developed with Visual Studio 2008 Pro on a 32bit Windows PC with 3GB of RAM.
During the startup of application I see that a large amount of memory is allocated. So far so good, but when I add many and many vision elaboration the memory allocation increases and a part of application (only Cognex OCX) stops working well. The rest of application stills to work (working threads, com on socket....)
I did whatever I could to save memory, but when the memory allocated is about 700MB I begin to have the problems. A note on the documentation of Cognex library tells that /LARGEADDRESSWARE is not supported. Anyway I'm thinking to try the migration of my app on win64 but what do I have to do?
- Can I simply use a processor with 64bit and windows 64bit without recompiling my application that would remain a 32bit application to take advantage of 64bit ? Or I should recompile my application ?
- If I don't need to recompile my application, can I link it with 64bit Congnex library?
- If I have to recompile my application, is it possible to cross compile the application so that my develop suite is on a 32bit PC?
Every help will be very appreciated!!
Thank in advance
You can run 32 bit apps on a 64-bit OS, but they run in "WoW" (windows on windows). That is, they still run as a 32 bit app, with all the restrictions a 32-bit app has. To run as a native 64 bit app, they have to be proper 64 bit applications.
Managed (C#) code is not 32/64 platform-specific - it will be JIT compiled into the correct sort of code to run natively on the host PC. However, any unmanaged code (C++, most third party dlls) will have been pre-compiled as 32-bit or 64-bit, so you have to use the correct version of the dll for your host PC.
If you try to run your program on 64 but use a 32-bit dll, when you try to call the dll your program will simply crash with a "bad image format" error.
So... to make your program truly 64 bit, you will need to build a version that links to the 64-bit Congnex library.
You can target any type of processor from Visual Studio, so you don't need to have a 64 bit PC to develop a 64 bit app (although you will beed a 64-bit pc to test it on!)
Project + Properties, Build tab, Platform Target. That should be set to Any CPU, the default. Which will automatically make your code run 64-bit when you run it on a 64-bit version of Windows. The JIT compiler takes care of it.
You will have to install the 64-bit version of the .ocx on the machine to make this work.
精彩评论