简体   繁体   English

在Windows JNI中使用.so文件

[英]Use .so file in Windows JNI

I want to use .so file in windows as shared library. 我想在Windows中使用.so文件作为共享库。 Normally windows uses .dll file as library. 通常,Windows使用.dll文件作为库。 But I don't know how to build my own DLL. 但是我不知道如何构建自己的DLL。

But I find a way to compile my .cpp to .so. 但是我找到了一种方法来将我的.cpp编译为.so。 In andriod app, it can load .so file as the library. 在andriod应用程序中,它可以将.so文件加载为库。 Can any one tell me if it is possible to load .so in windows? 谁能告诉我是否可以在Windows中加载.so?

I found a way online. 我找到了一种在线方式。 It is said that the function System.load() with absolute path can work. 据说具有绝对路径的函数System.load()可以工作。 Actually, it doesn't work for me. 实际上,它对我不起作用。

System.load("E:/XXX/libtest.so")

Anyone has any idea? 有人知道吗?

A .so shared object is a library for use on a *nix platform. .so共享库是在* nix平台上使用的库。 You cannot load them in Windows. 您不能在Windows中加载它们。 You need to compile the source code to a Windows DLL, and load that. 您需要将源代码编译为Windows DLL,然后进行加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM