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

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

问题描述

我在我的Windows 7 64位上安装了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的函数时,异常线程中的异常mainjava.lang.UnsatisfiedLinkError:D:\path\mylib.dll:无法加载IA 32位.dll在AMD 64位平台上
被抛出。
所以看起来我需要构建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:\path\mylib.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设置才能这样做?

关于Marc

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

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 )有一些很好的工作在个人建设

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天全站免登陆