如何使用与Java一个Windows DLL在Mac OS X? [英] How to use a Windows DLL with Java in Mac OS X?

查看:2486
本文介绍了如何使用与Java一个Windows DLL在Mac OS X?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了使用 taucs.dll 一些Java项目的 TAUCS -aç稀疏线性解算器库,通过JNI在Windows中。我想我可以通过编译TAUCS成类似 libTaucs.jnilib 实现在Mac OS X相同。我有机会到库的code,但不知道如何把它编译成一个DLL,更不用说JNI库。到目前为止,我只能编译成静态库。

I have seen some Java projects using taucs.dll, TAUCS—a C library of sparse linear solvers, through JNI in Windows. I guess I can achieve the same in Mac OS X by compiling TAUCS into something like libTaucs.jnilib. I have access to the library's code but no idea how to compile it into a DLL, let alone a JNI library. So far I can compile only to a static library.

有没有办法到DLL转换为JNI库for Mac吗?如果非要编译code,该怎么办呢?将包装静态库与JNI动态库的工作,特别是对TAUCS如果任何人有经验?

Is there a way to convert a DLL to a JNI library for Mac? If I have to compile the code, how to do so? Will wrapping a static library in a dynamic library work with JNI, especially for TAUCS if anyone has an experience?

推荐答案

很多操作系统都共享库的概念,但ofcourse这样的库的格式等是不同的操作系统不同。

Many operating systems have the concept of shared libraries, but ofcourse the format etc. of such libraries is different on different operating systems.

的DLL(动态链接库)是共享库的Windows版本。你不能只用一个DLL在Mac OS系统的Windows机器,就像你不能运行在Mac OS Windows应用程序(或任何其他操作系统)。

DLLs (Dynamically Linked Libraries) are the Windows version of shared libraries. You cannot just use a DLL from a Windows machine on Mac OS, exactly like you cannot run a Windows application on Mac OS (or any other operating system).

而不是试图使用在Mac OS上一个Windows DLL,你需要找到你要使用本机库的的Mac OS特定版本。或者,如果你有源$ C ​​$ C,它编译成的Mac OS本地共享库。在Mac OS X共享库的扩展。所以(而不是.dll文件),它的全称是共享对象。结果
使用加载它们只是Java是不可能的。

Instead of trying to use a Windows DLL on Mac OS, you need to find a Mac OS-specific version of the native library that you are trying to use. Or if you have the source code, compile it into a Mac OS-native shared library. Shared libraries on Mac OS X have the extension .so (instead of .dll), which stands for "shared object".
Loading them using just Java is not possible.

这篇关于如何使用与Java一个Windows DLL在Mac OS X?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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