图像分析和64位操作系统
我开发了一个使用 Congex 视觉库 (VPro) 的 C# 应用程序。我的应用程序是在具有 3GB RAM 的 32 位 Windows PC 上使用 Visual Studio 2008 Pro 开发的。
在应用程序启动期间,我看到分配了大量内存。到目前为止一切顺利,但是当我添加很多很多视觉阐述时,内存分配会增加,并且应用程序的一部分(仅 Cognex OCX)会停止正常工作。应用程序的其余部分仍然可以工作(工作线程、套接字上的 com...)
我尽了一切努力来节省内存,但是当分配的内存约为 700MB 时,我开始遇到问题。 Cognex 库文档上的注释表明不支持 /LARGEADDRESSWARE。无论如何,我正在考虑尝试在 win64 上迁移我的应用程序,但我必须做什么?
- 我是否可以简单地使用 64 位处理器和 Windows 64 位而不重新编译我的应用程序(该应用程序仍然是 32 位应用程序)以利用 64 位?或者我应该重新编译我的应用程序?
- 如果我不需要重新编译我的应用程序,我可以将其与 64 位 Congnex 库链接吗?
- 如果我必须重新编译我的应用程序,是否可以交叉编译该应用程序,以便我的开发套件位于 32 位 PC 上?
我们将非常感谢您的每一次帮助!
提前致谢
I developed a C# application that makes use of Congex vision 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 64 位操作系统上运行 32 位应用程序,但它们运行在“WoW”(Windows on Windows)中。也就是说,它们仍然作为 32 位应用程序运行,并具有 32 位应用程序所具有的所有限制。要作为本机 64 位应用程序运行,它们必须是正确的 64 位应用程序。
托管 (C#) 代码不是特定于 32/64 平台的 - 它将被 JIT 编译成正确类型的代码,以便在主机 PC 上本机运行。但是,任何非托管代码(C++、大多数第三方 dll)都将被预编译为 32 位或 64 位,因此您必须为您的主机使用正确版本的 dll。
如果您尝试在 64 位上运行程序但使用 32 位 dll,则当您尝试调用该 dll 时,您的程序将崩溃并出现“图像格式错误”错误。
所以...为了使您的程序真正成为 64 位,您需要构建一个链接到 64 位 Congnex 库的版本。
您可以从 Visual Studio 瞄准任何类型的处理器,因此您不需要有 64 位 PC 来开发 64 位应用程序(尽管您将使用 64 位 PC 来测试它!)
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!)
项目+属性,构建选项卡,平台目标。应将其设置为默认值“任何 CPU”。当您在 64 位版本的 Windows 上运行代码时,这将自动使您的代码以 64 位运行。 JIT 编译器会处理它。
您必须在计算机上安装 64 位版本的 .ocx 才能正常工作。
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.