如何在eclipse中插入特定于平台的代码? [英] How to insert platform-specific code in eclipse?

查看:116
本文介绍了如何在eclipse中插入特定于平台的代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个由多个插件组成的基于Eclipse的应用程序.这些插件之一执行计算量大的任务,因此我想为我支持的某些平台提供本机"实现.最好的方法是什么?

I'm working on an eclipse-based application, composed by several plug-ins. One of these plugins performs a computationally-intensive task, hence I want to provide a "native" implementation for some platforms I support. What is the best way to do it?

我在考虑一个基础插件(提供默认实现),该插件扩展了一些片段(以提供特定于平台的实现).但是,基本插件如何知道可用的片段?

I was thinking about a base plugin (which provides the default implementation) extended with some fragments (to provide platform-specific implementations). However, how can the base plugin be aware of the available fragments?

推荐答案

您可以在主插件中编写类似于

You could write a class in your main plugin similar to LocalFileNatives from org.eclipse.core.filesystem. It loads a library that implements its set of native methods. It then provides a facade to the system that uses the native implementation if it is available but has some default functionality for platforms where there are no native implementations.

然后每个平台片段仅提供适当的本机DLL或.so

Then each platform fragment simply provides the appropriate native DLL or .so

还有其他一些选项可以让片段提供服务,主机插件可以检索该服务.

There are other options for having the fragment supply a service, that can be retrieved by the host plugin.

这篇关于如何在eclipse中插入特定于平台的代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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