[待测试特性]

一、C接口导出相关

1、重载函数。

2、虚函数。

3、template相关

二、内存相关

1、as直接往c分配的内存写数据。

2、c直接往as对象写数据。

三、C访问AS

1、访问as中的基本类型变量

2、访问as中的复杂类型变量

3、访问as中的function对象

4、inline assembly. 官方文档说明如下:

  The interop between AS3 and C/C++ in FlasCC is based around the concept of inline assembly. In a native C/C++ workflow you would use inline assembly statements to allow you to pass arbitrary strings containing platform specific instructions to the assembler to be included in your final executable. With FlasCC the underlying system is the Flash Runtime, and the language it supports natively is AS3, so these inline assembly statements let you talk to the native Flash API set in the language it was designed with.

  其中有两种常用的macro, inline_as3 和 package_as3。用法如下:

#include <AS3/AS3.h>

// Use AS3 to sqrt a double!
double somenumber = 45.0;
double result = 0.0;
inline_as3(
"%0 = Math.sqrt(%1);\n"
: "=r"(result) : "r"(somenumber)
); // Back in C we can take the result and print it out:
printf("sqrt of %f is %f\n", somenumber, result);
package_as3("#package public\n var somepublicvar:int = 42;");
package_as3("#package private\n var someprivatevar:int = 42;");
package_as3("#package com.example.yourpackage\n var somespecialvar:int = 42;");

四、AS访问C

五、多线程(pthread与worker)

adobe官方对于pthread的说明:

http://www.adobe.com/devnet/games/articles/pthreads-flascc.html

其中有一段话很重要:

Flascc Pthreads are implemented using ActionScript workers. Creation of a Pthread causes the creation of an AS3 Worker object on which the Pthread start_routine runs. Workers created for Pthread execution automatically share C memory with other Pthreads including the main Pthread. Global and static variables are shared between Pthreads. Therefore, C data—including pointers to scalars, function pointers, and so on—can be safely shared between Pthreads. However, AS3 values are not shared between workers and therefore are not generally shareable between Pthreads.

六、flascc中比较难理解的接口和系统概念

1、flascc模块的初始化入口

  和c程序类似, 一个flascc模块建议使用一个main函数作为其入口。

  AS3_GoAsync宏

  When breaking a C/C++ run-loop so that FlasCC code is suitable for use without using multi-threading you need to execute main, so the static initializers for your code are run, but you want to prevent the static destructors from running so it is important that main does not return. By throwing an AS3 exception and preserving the stack we can effectively interrupt the execution of main.

2、as中对于flascc模块的加载

  要使用一个flascc编写的模块swc, 在使用之前要对其进行加载, 也就是初始化, 这个要利用CModule来操作。 对于CModule要说明的是, 每一个flascc模块swc都有一个唯一对应的CModule类, 利用这个类可以对与之对应的swc进行操作,比如初始化, 读写内存等。

七、系统模块说明

1、CModule

  1.1 初始化接口

  1.1.1 start()

     Calls the libc __start1 function which, in turn, causes main() to execute.

  1.1.2 startAsync()

     Calls the libc __start1 function which, in turn, causes main() to execute. Unlike start(), this method handles the case where the main C run loop has been broken by a call to "AS3_GoAsync" within the C code. This allows main to return without allowing C/C++ static initializers to run. This should be used when you want to run long running code with a broken run-loop, or run some code as a library.

  1.1.3 startBackground()

     Creates a background Worker and runs the libc function __start1 within that Worker. This allows you to run main without breaking the run loop, but requires the SWF to be version 18 or higher (Flash Runtime 11.5).

  这三个接口的参数一致, 如下:

Parameters
    console:Object (default = null) — The current Console object
 
    args:Vector.<String> (default = null) — A vector of Strings that are used to fill the argv array given to main. The first String is typically used to specify the name of the application.
 
    env:Vector.<String> (default = null) — A vector of Strings that are used to populate the environment variables accesible by getenv(). There should be an even number of Strings in this Vector as they are treated as name/value pairs.
 
    afterStackSize:int (default = 65536) — The amount of stack space to allocate for the ui thread (code that will run the uiThunk callbacks and also any calls to callI coming from the main Worker).

  1.2 property

  1.2.1 rootSprite

  如果仅仅是在一个单线程里加载并使用flascc模块, 随便new sprite给这个属性就好。

  奇怪的是,如果在flascc模块里用到pthread创建另外一个线程, 如果rootSprite的loadInfo为空的话, 就会报错。这就意味着必须用根sprite或者一个动态加载的swf才能赋给这个属性。

2、Console

3、IVFS

4、ISpecialFile

5、IKernel

  

flasCC技术点记录的更多相关文章

  1. Qt:小项目仿QQ修改头像界面,技术点记录

    最近写了一个修改头像功能的UI,布局参考了QQ目前的修改头像界面.如下图 这里主要说明一下两个地方的技术:1.头像图片上层的遮罩层,圆形外部为灰色,内部为全透明:2.上传图片宽高比例可以通过鼠标拖拽移 ...

  2. (转)java缓存技术,记录

    http://blog.csdn.net/madun/article/details/8569860 最近再ITEYE上看到关于讨论JAVA缓存技术的帖子比较多,自己不懂,所以上网大概搜了下,找到一篇 ...

  3. 微博与Redis系统技术文章记录

    Redis 持久化,有两种: rdb 和 aof, rdb是记录一段时间内的操作,一盘的配置是一段时间内操作超过多少次就持久化. aof可以实现每次操作都持久化. 这里我们使用aof. 配置方式,打开 ...

  4. android 技术点记录

    Android Service完全解析,关于服务你所需知道的一切(上) http://blog.csdn.net/guolin_blog/article/details/11952435 androi ...

  5. php页面静态化技术;学习笔记

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  6. 四项技术 助你提高SQL Server的性能

    有时,为了让应用程序运行得更快,所做的全部工作就是在这里或那里做一些很小调整.但关键在于确定如何进行调整!迟早您会遇到这种情况:应用程序中的 SQL 查询不能按照您想要的方式进行响应.它要么不返回数据 ...

  7. TCPDump:捕获并记录特定协议 / 端口

    Q. 如何使用 Linux / UNIX 平台下的 TCPDump 工具捕获特定协议或端口比如 80 (http)?如何使用 TCPDump 将流记录下来,然后(根据记录)查找到问题所在?       ...

  8. JavaWeb学习笔记五 会话技术Cookie&Session

    什么是会话技术? 例如网站的购物系统,用户将购买的商品信息存储到哪里?因为Http协议是无状态的,也就是说每个客户访问服务器端资源时,服务器并不知道该客户端是谁,所以需要会话技术识别客户端的状态.会话 ...

  9. 会话技术、Cookie技术与Session技术

    一.会话技术  1. 存储客户端状态 会话技术是帮助服务器记住客户端状态(区分客户端)的.  2. 会话技术 从打开一个浏览器访问某个站点,到关闭这个浏览器的整个过程,称为一次会话.会话技术就是记录这 ...

随机推荐

  1. AJAX和jQuery Ajax总结

    AJAX全称为“Asynchronous JavaScript And XML”(异步JavaScript和XML),是指一种创建交互式网页应用,改善用户体验,实现无刷新效果的技术. 使用AJAX的优 ...

  2. 我的android学习经历29

    四大组件之广播接收者BroadcastReceiver 新建广播接收器 需要新建一个类继承类BroadcastReceiver,并且重写其中的方法onReceive(),不要在这个方法中添加过多的逻辑 ...

  3. spring事务管理-摘抄

    原著网址 http://gcq04552015.iteye.com/blog/1666570 Spring是以代理的方式实现对事务的管理.我们在Action中所使用的Service对象,其实是代理对象 ...

  4. eclipse选中变量,相同变量高亮。

    选择Windows->Preferences->Java->Editor->Mark Occurrences,全部选择并保存. 如下图:

  5. JQuery中Ajax的Post提交中文乱码的解决方案

    出自:http://m.blog.csdn.net/blog/blueheart20/26370023 引言: 在JQuery的Ajax POST请求中,进行请求,其中的中文在后台,显示为乱码,该如何 ...

  6. HDU 2222 Keywords Search(查询关键字)

    HDU 2222 Keywords Search(查询关键字) Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K ...

  7. Python基础学习笔记(九)常用数据类型转换函数

    参考资料: 1. <Python基础教程> 2. http://www.runoob.com/python/python-variable-types.html 3. http://www ...

  8. POJ-2175 Evacuation Plan 最小费用流、负环判定

    题意:给定一个最小费用流的模型,根据给定的数据判定是否为最优解,如果不为最优解则给出一个比给定更优的解即可.不需要得出最优解. 解法:由给定的数据能够得出一个残图,且这个图满足了最大流的性质,判定一个 ...

  9. IQ一个人的智力和对科学知识的理解掌握程度。 EQ对环境和个人情绪的掌控和对团队关系的运作能力。 AQ挫折商 一个人面对困境时减除自己的压力、渡过难关的能力。

    IQ: Intelligence Quotient 智商 一个人的智力和对科学知识的理解掌握程度. EQ: Emotional Quotient 情商 一个人对环境和个人情绪的掌控和对团队关系的运作能 ...

  10. 10 database tables

    本章提要-----------------------------------各种数据库表的讨论, 并介绍什么情况使用哪种表情调表的物理存储特征---------------------------- ...