android使用Visual Studio 运行Firefox浏览器插件实例npruntime

  次阅读 来源:互联网(转载协议) 2015-10-02 21:19 我要评论(0)

最近在研究Android上浏览器插件.. 资料比较少.. 基本都是从研究NPAPI开始的.. 那么我也从这开始吧...

由于这篇文章是边做实验边记录, 加上本身对VS不太了解, 可能有些地方不对, 欢迎大家指正!!

npruntime

参照下述步骤一步一步来:

Build

1.Create a new project in Visual Studio for a Win32 GUI library (DLL) (in .NET 2003: Win32 template, then switch to DLL in Application Settings in the following dialog, export symbols too?)(in Visual Studio 2008, it isVisualc++|Win32|Win32 Project, then check DLL in the wizard).

2.If a wizard gives you a checkbox to create an empty project, then check it. Otherwise you'll delete files later.

3.Again note that the resulting DLL filename must start with "np", so either call your project like this or rename the file later

4. Delete the .cpp and .h and ReadMe files from the project and disk (if you did not create an empty project)

5. Copy the npruntime sample plugin source code into the dir of the new VS project and add the files to the project using the VS GUI (.cpp files to "Source Files", .h files to "Header Files", .rc file to "Resource Files"). Samples can be obtained from: https://developer.mozilla.org/en/Plugins/Samples_and_Test_Cases

6. Download the Gecko SDK (aka XULRunner SDK) from mozilla.org release FTP and extract it. You can download it from here: http://developer.mozilla.org/en/docs/Gecko_SDK

7. Add the Gecko SDK include path (example : C:/xulrunner-sdk/sdk/include) to Project Properties|(all configurations)|C++|General|Additional Include Directories. Note: If your project is still empty, the C++ tree might not be visible. So, add some files first.

8. Add the following preprocessor definitions to Project Properties|(all configurations)|C++|Preprocessor|Preprocessor Definitions:WIN32;_WINDOWS;XP_WIN32;MOZILLA_STRICT_API;XPCOM_GLUE;XP_WIN;_X86_;NPSIMPLE_EXPORTS

9.Disable precompiled headers using Project Properties|(all configurations)|C++|Precompiled headers|Create/Use precompiled header. They may be already disabled.

10. Define the function exports by adding the .def filename (e.g. nprt.def) to Project Properties|(all configurations)|Linker|Input|Module Definition File. It could be either the full path or the path relative to the project directory.

11. Optional: Open the above .def file and change "NPRT" to the filename of your dll as VS sees it (without "np", if you decided to rename later)

12. Optional: Edit the .rc file and and the top of npp_gate.cpp for the description, mimetype, file extension etc. to reflect your plugin

13. Remove the function NPP_GetJavaClass from npp_gate.cpp

14. Build

15. Rename the resulting DLL so that the filename starts with "np" and ends with ".dll" (or "32.dll"? 8.3?) and copy it in Mozilla's "plugins" folder

16. Start Mozilla and open about:plugins to verify the plugin is detected

17. Open the file "test.html" and begin testing. Make sure the mimetypes of your html embed tags match the mimetype specified in your nprt.rc file and the top of your npp_gate.cpp file

第一步:

第二步:

(因为选择的空项目,第三、第四步省略)

第五步:导入源码

npruntime 源码结构:

本站部分文章来源于网络以及网友投稿,本站只负责对文章进行整理、排版、编辑,是出于传递更多信息之目的,并不意味着赞同其观点或证实其内容的真实性。如果您有什么意见或建议,请联系QQ28-1688-302!

人工智能实验室
相关文章相关文章
  • teamLab创始人猪子寿之: 抛去衣食住行,我还剩下什么?

    teamLab创始人猪子寿之: 抛去衣食住行,我还剩下什么?

  • Oculus公布原型机,大幅度提升可视角,能实现140°的视场水平

    Oculus公布原型机,大幅度提升可视角,能实现140°的视场水平

  • Michael I. Jordan带你解读百万奖金ATEC蚂蚁人工智能大赛

    Michael I. Jordan带你解读百万奖金ATEC蚂蚁人工智能大赛

  • 2018深圳国际人工智能展览会 2018 shenzhen International Artif

    2018深圳国际人工智能展览会 2018 shenzhen International Artif

网友点评网友点评
阅读推荐阅读推荐

据外媒报道,STEER打造了首款完全自动驾驶停车技术,旨在使常规车辆转变为无人驾驶车辆。STEER的首款技术应用是4级自动驾驶及网络安全停车...

近日,美国软性机器抓手制造商 Soft Robotics 宣布,获得 2000 万美元的融资,本轮投资者包括 Scale Venture Partners,Calibrate Ventures...

据外媒报道,加州车管局发布了《2017自动驾驶脱离报告(California Autonomous Vehicle Disengagement Reports)》,其中谈及了脱离的具体...

用人机语音交互,来解决智能家居适老的问题;通过家庭门禁与安防套件、空气净化套件、可燃气体与有害气体监控套件等相互联动,在不同生活情...