在java中使用C#dll [英] Using C# dll in java

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

问题描述

我试图在c#中使用外部.dll文件编码,在我的Java应用程序中,我所知道的dll包含与我们可以使用的功能的接口,我可以将dll加载到我的java应用程序,但是如何使用它内的接口?我不知道JNI在这种情况下可以如何帮助。请帮助。

解决方案

您可以使用C#由 Robert Giesecke 编写的项目模板。这允许您在C#DLL中创建本机C风格的API导出,并从Java或几乎任何其他语言中调用它们。向下滚动到非托管导出库文件的页面底部。



或者,您可以使用 ComVisible 创建一个COM类,并从Java访问。


Im trying to use external .dll file coding in c# ,in my Java application , what I know about the dll that it contains interfaces with functions we can use ,I can load the dll to my java application , but how i can use the interfaces within it ? I dont know how JNI can help in this case .Please help .

解决方案

You can create native exports from your C# DLL using a project template written by Robert Giesecke. This allows you to create native C-style API exports in your C# DLL, and call them from Java or almost any other language. Scroll down to the bottom of the page for the Unmanaged Export Library file.

Alternatively, you could use ComVisible to create a COM class and access it from Java.

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

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