VS2013编译最简单的PPAPI插件
来源:互联网 发布:aloha什么软件 编辑:程序博客网 时间:2024/05/24 04:50
我想在CEF里使用PPAPI,CEF使用VS 2013 Update 4编译。因此我尝试了使用VS 2013来编译PPAPI插件。
PPAPI的代码在这里:https://chromium.googlesource.com/chromium/src/ppapi/,可以用下列命令check出来:
git clone https://chromium.googlesource.com/chromium/src/ppapi
也可以下载master分支的tgz包。
VS工程
新建一个Win32项目,类型选DLL,去掉预编译头文件stdafx.h和stdafx.cpp,并且在项目属性–>配置属性–>C/C++–>预编译头,把预编译头选项的值设置为不使用预编译头。
复制ppapi/examples/stub/stub.c文件到项目文件夹下,并添加到项目里。做简单修改,打印点儿调试信息。stub.c内容如下:
// Copyright (c) 2010 The Chromium Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.// This is the simplest possible C Pepper plugin that does nothing. If you're// using C++, you will want to look at stub.cc which uses the more convenient// C++ wrappers.#include <stddef.h>#include <stdint.h>#include <Windows.h>#include <tchar.h>#include "ppapi/c/pp_errors.h"#include "ppapi/c/pp_module.h"#include "ppapi/c/ppb.h"#include "ppapi/c/ppp.h"#include "ppapi/c/pp_instance.h"#include "ppapi/c/ppp_instance.h"PP_Module g_module_id;PPB_GetInterface g_get_browser_interface = NULL;PP_EXPORT int32_t PPP_InitializeModule(PP_Module module_id, PPB_GetInterface get_browser_interface) { // Save the global module information for later. g_module_id = module_id; g_get_browser_interface = get_browser_interface; OutputDebugString(_T("PPP_InitializeModule was called\r\n")); return PP_OK;}PP_EXPORT void PPP_ShutdownModule() {OutputDebugString(_T("PPP_ShutdownModule was called\r\n"));}PP_EXPORT const void* PPP_GetInterface(const char* interface_name) { // You will normally implement a getter for at least PPP_INSTANCE_INTERFACE // here. OutputDebugString(_T("PPP_GetInterface was called\r\n")); return NULL;}
PPAPI plugin
参考https://code.google.com/p/ppapi/wiki/GettingStarted,C语言版的PPAPI plugin,必须实现下列函数:
- PPP_InitializeModule,插件加载时会被调用,返回0表示成功
- PPP_ShutdownModule,插件卸载时会被调用
- PPP_GetInterface,浏览器创建插件实例时会被调用
这些函数在ppp.h中定义。实现这些函数时,使用PP_EXPORT宏修饰一下即可。
一个DLL,实现了上述三个函数,就可以做为PPAPI插件来用了,不过只是样子货,只能看到被加载、创建,干不了什么实际的事儿,是个PPAPI 版本的Hello World。
后面我们会改造stub,显示点东西出来。
相关文章参考:
- CEF Windows开发环境搭建
- CEF加载PPAPI插件
0 0
- VS2013编译最简单的PPAPI插件
- 编译PPAPI的media_stream_video示例
- PPAPI插件与浏览器的交互过程
- PPAPI插件与浏览器的通信
- PPAPI插件的全屏切换处理
- PPAPI插件的动态创建、修改、删除
- 自己编译android版chrome,支持ppapi插件
- CEF加载PPAPI插件
- PPAPI 插件编写
- PPAPI插件开发指南
- PPAPI插件开发指南
- PPAPI插件的绘图与输入事件处理
- 最简单的transform的编写步骤(win10+vs2013)
- VS2013生成个最简单的NT式驱动程序
- cef3 加载flash ppapi插件
- NPAPI和PPAPI插件开发
- 理解PPAPI的设计
- Eclipse插件的最简单安装方法
- How to refresh materialized view in oracle
- HDOJ 2042 不容易系列之二
- std::set自定义比较函数
- Matlab 生成任意扇形区域
- Java读取并修改图片的像素值
- VS2013编译最简单的PPAPI插件
- android的消息处理机制(图+源码分析)——Looper,Handler,Message
- hdu1228——A+B
- 推荐:如何高效学习使用Axure ?
- <LeetCode OJ> 62. / 63. Unique Paths(I / II)
- 树与二叉树的一些概念
- 外链时代已终结?营销外链时代才刚刚开始!
- 关于echo命令网上查的些小资源
- C/C++预处理指令#define #ifdef #ifndef #endif