[待测试特性]

一、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. hibernate.properties

    hibernate.dialect=org.hibernate.dialect.MySQL5Dialect #hibernate.dialect=org.hibernate.dialect.Oracl ...

  2. 【Toolkit】关闭Closeable的简单工具类

    Java中有很多连接类的类实现java.io.Closeable,而关闭资源是一项重复的劳动,写一个简单的工具类避免重复劳动. > JDK7.0中,哪些类实现java.io.Closeable?

  3. UVA 607 二十二 Scheduling Lectures

    Scheduling Lectures Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submi ...

  4. UVA 10163 十六 Storage Keepers

    十六 Storage Keepers Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit ...

  5. 正则表达式(/[^0-9]/g,'')中的"/g"是什么意思 ?

    正则表达式(/[^0-9]/g,'')中的"/g"是什么意思 ?     表达式加上参数g之后,表明可以进行全局匹配,注意这里“可以”的含义.我们详细叙述: 1)对于表达式对象的e ...

  6. Creating Object Library OLB in Oracle D2k Form

    With following steps you can create Object Library (OLB) in Oracle D2k Forms.Step - 1Create a form i ...

  7. ERROR 1044 (42000) ERROR 1142 (42000): SELECT command denied to user ''@'localhost' for table 'user'

    ERROR: Access denied for user 'root'@'localhost' (using password: NO)    发现:    mysql -u root@localh ...

  8. python_way day16 JQuary

    python_way day16 JQuery 封装dom js代码 jQuery(1.10,1.12-兼容性好,2.0.以后放弃了ie9以下) - 封装了Dom & JavaScript 查 ...

  9. .NET/C# 使用Stopwatch测量运行时间

    Stopwatch类:http://msdn.microsoft.com/zh-cn/library/system.diagnostics.stopwatch(v=vs.100).aspx 常用属性和 ...

  10. Python基础学习笔记(一)入门

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