在 Eclipse 中使用 MinGW 32 位构建 64 位 dll [英] Building 64 bit dll with MinGW 32 bit in Eclipse

查看:36
本文介绍了在 Eclipse 中使用 MinGW 32 位构建 64 位 dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 64 位 Windows 7 上安装了 32 位版本的 Mingw 4.7.2(使用安装程序).我在 Eclipse C++ 项目中使用 MinGW 来构建一个 .dll 文件.到目前为止,一切正常.

I installed the 32 bit version of Mingw 4.7.2 (using the installer) on my Windows 7 64 bit. I use MinGW in an Eclipse C++ project in order to build a .dll file. So far everything works.

但是我使用这个 .dll 通过 JNI 包含在一个 java 项目中.当我在 java 项目中调用 .dll 的函数时,异常 "Exception in thread "main" java.lang.UnsatisfiedLinkError: D:pathmylib.dll: Can't load IA 32-bit .AMD 64 位平台上的 dll"被抛出.所以看起来我需要构建一个 64 位版本的 DLL.

However I use this .dll to be included in a java project via JNI. And when I call a function of the .dll in the java project the exception "Exception in thread "main" java.lang.UnsatisfiedLinkError: D:pathmylib.dll: Can't load IA 32-bit .dll on a AMD 64-bit platform" is thrown. So it seem like I need to build an 64 bit version of the DLL.

所以我的问题是:

  1. 我可以使用 MinGW 32 位构建 64 位 DLL 还是需要 MinGW 64 位版本?
  2. 如果是,我需要如何调整 MinGW 和/或 Eclipse 设置才能这样做?

问候马克

正如您在下面的评论中看到的,我已经尝试设置 -m64 标志来构建 64 位 dll.这会导致错误:抱歉,未实现:64 位模式未编译".那么有没有办法让 64 位模式在 mingw32 中运行.

As you can see in the comment below, I already tried to set the -m64 Flag to build a 64 bit dll. This results in the error: "sorry, unimplemented: 64-bit mode not compiled in". So is there a way to get the 64 bit mode running in mingw32.

推荐答案

我最近遇到了同样的问题,安装 MinGW-64 版本启用了 -m64 标志我.您可以从 这里.

I recently faced the same problem, installing the MinGW-64 version enabled the -m64 flag for me. You can get an automated build from here.

有些人 (rubenvb) 在 Personal Builds 中做得很好:

EDIT : Some guy (rubenvb) made some good job in the Personal Builds :

有 gcc 4.7.4 此处 甚至 4.8.0 这里.

There's gcc 4.7.4 here and even 4.8.0 here.

这篇关于在 Eclipse 中使用 MinGW 32 位构建 64 位 dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆