[error] Can't load IA 32-bit .dll on a AMD 64-bit plat
来源:互联网 发布:找不到网络共享文件夹 编辑:程序博客网 时间:2024/05/07 22:15
刚刚在使用JNI(Java Native Interface)的时候,准备把C程序在windows命令行或Visual Studio Command Prompt(2013)命令行下使用VS的cl命令编译链接生成dll动态链接库文件。所以按照传统方法在命令行vs安装目录/common7/Tools/下执行vsvars32.bat,然后执行cl指令。问题来了,这个vsvars32.bat相当于配置了32位系统环境为编译平台,所以在64位机器上加载调用生成的32位DLL文件就报错了。
这里http://blog.csdn.net/lijie45655/article/details/6730885有一篇关于cl命令的详解,本想通过/MACHINE选项来指定64位平台的,但不可行。。
后来找到这里https://msdn.microsoft.com/en-us/library/x4d2c09s.aspx,点击打开链接 (下面做个内容备份)
Visual Studio includes 32-bit, x86-hosted, native and cross compilers for x86, x64, and ARM targets. When Visual Studio is installed on a 64-bit Windows operating system, 32-bit, x86-hosted native and cross compilers, and also 64-bit, x64-hosted native and cross compilers, are installed for each target (x86, x64, and ARM). The 32-bit and 64-bit compilers for each target generate identical code, but the 64-bit compilers support more memory for precompiled header symbols and the Whole Program Optimization (/GL, /LTCG) options. If you run into memory limits when you use a 32-bit compiler, try the 64-bit compiler.
When Visual Studio is installed on a 64-bit Windows operating system, additional Command Prompt shortcuts for the 64-bit x64-native and x86 cross compilers are available. To access these command prompts on Windows 8, on the Start screen, open All apps. Under the installed version of Visual Studio, open Visual Studio Tools, and then choose one of the native-tool or cross-tool command prompts. On earlier versions of Windows, choose Start, expand All Programs, Visual Studio, Visual Studio Tools, and then choose a command prompt.
Vcvarsall.bat
Any of the compilers can be used on the command line by running thevcvarsall.bat command file to configure the path and environment variables that enable the compiler toolset. Because there are no Command Prompt shortcuts to enable a 64-bit toolset to target x86 or ARM platforms, use vcvarsall.bat in a Command Prompt window to use the 64-bit toolset instead.For more information, see Setting the Path and Environment Variables for Command-Line Builds.
The following steps show how to configure a Command Prompt to use the 64-bit native toolset to target x86, x64, and ARM platforms.
To run vcvarsall.bat to use a 64-bit toolset
At the command prompt, change to the Visual C++ installation directory. (The location depends on the system and the Visual Studio installation, but a typical location is C:\Program Files (x86)\Microsoft Visual Studio version\VC\.) For example, enter:
cd "\Program Files (x86)\Microsoft Visual Studio 12.0\VC"
To configure this Command Prompt window for 64-bit command-line builds that targetx64 platforms, at the command prompt, enter:
vcvarsall amd64 //运行这条指令就可以配置目标系统平台为64位机了
To configure this Command Prompt window for 64-bit command-line builds that targetx86 platforms, at the command prompt, enter:
vcvarsall amd64_x86
To configure this Command Prompt window for 64-bit command-line builds that targetARM platforms, at the command prompt, enter:
vcvarsall amd64_arm
D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>vcvarsall amd64
D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC>cd D:\WorkSpace\eclipseWorkspace\JNI-example\src
D:\WorkSpace\eclipseWorkspace\JNI-example\src>cl /LD "factorial.c" /I "C:\Program Files\Java\jdk1.8.0_65\include" /I "C:\Program Files\Java\jdk1.8.0_65\include\win32"
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.21005.1 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
factorial.c
Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation. All rights reserved.
/out:factorial.dll
/dll
/implib:factorial.lib
factorial.obj
Creating library factorial.lib and object factorial.exp
D:\WorkSpace\eclipseWorkspace\JNI-example\src>javac JniApp.java
D:\WorkSpace\eclipseWorkspace\JNI-example\src>java JniApp
Factorial of 5 is: 120
- [error] Can't load IA 32-bit .dll on a AMD 64-bit plat
- Can't load IA 64-bit .dll on a AMD 64-bit plat
- error:Can't load AMD 64-bit .dll on a IA 32-bit platform
- tcnative-1.dll Can't load AMD 64-bit .dll on a IA 32-bit platform
- jogl.dll : Can't load IA 32-bit .dll on a AMD 64-bit platform
- JEncryptTool.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform
- tcnative-1.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
- Can't load AMD 64-bit .dll on a IA 32-bit platform
- Tomcat Can't load AMD 64-bit .dll on a IA 32-bit platform
- 解决Tomcat: Can't load IA 32-bit .dll on a AMD 64-bit platform问题
- WTK Can't load IA 32-bit .dll on a AMD 64-bit platform
- 完美解决 Can't load AMD 64-bit .dll on a IA 32-bit platform
- Can't load AMD 64-bit .dll on a IA 32-bit platform
- Tomcat7: Can't load IA 32-bit .dll on a AMD 64-bit platform解决
- Can't load IA 32-bit .dll on a AMD 64-bit platform解决方案
- 解决Tomcat: Can't load IA 32-bit .dll on a AMD 64-bit platform问题
- 解决Tomcat: Can't load IA 32-bit .dll on a AMD 64-bit platform问题
- Can't load IA 32-bit .dll on a AMD 64-bit platform
- 2016.7.12 做题汇总! 打卡!
- Qiuck_Cocos基础(二)
- Three.js学习笔记 – “我和小伙伴都惊呆了”的特效和Three.js初探
- 第一次申请去美国面签,需要注意哪些事项提高成功率?
- PCHunter —— 很强大的系统信息查看工具
- [error] Can't load IA 32-bit .dll on a AMD 64-bit plat
- 01背包详解
- 如何把穿丝袜的女人拍的很好看?
- 白色丝袜女生怎么搭配好看,以及,有哪些漂亮/有趣的白色丝袜?
- 简论select()的接口设计与内核实现的得失(3)——The C10M Problem
- bootstrap3-dialog使用实例
- 设计模式(2)-创建型-简单工厂,工厂,抽象工厂模式(Factory)
- 这是测试的博客
- JavaEE学习笔记之SSH—Struts2(4)