Common Language Extension : Architecture

 
    Common Language Extension(CLE) is a realization of common object environment. It manages interface objects and presents interface to c/c++, lua, java, python, php, c#, etc. Through these interface, special language can create, define, and control interface objects, define their functions and events, or call their functions.
    Architecture of objects in CLE is as follows,

    Objects are grouped into four kinds: service group object, service object, service item object, object, where service item object may be not existed if you do not develop distributed applications. 
    Applications based on CLE, mainly is create and init the above four kinds of object. Specific functions or events are provided by object.
The following code is a simple example for java calling lua.

String LuaString;
LuaString =             "SrvGroup = libstarcore._GetSrvGroup()\n";
LuaString = LuaString + "Service = SrvGroup:_GetService(\"\",\"\")\n";
LuaString = LuaString + "Obj=Service:_New(\"TestClass\");\n";
LuaString = LuaString + "function Obj:Add(x,y)\n";
LuaString = LuaString + "  return x+y;\n";
LuaString = LuaString + "end\n";  
        Service._CheckPassword(false);
SrvGroup._RunScript("lua",LuaString,"");
StarObjectClass Obj = Service._GetObject("TestClass")._New();
System.out.println(Obj._Call("Add",234,567));

In above example, Interface object “TestClass” is defined by lua, for java to call its function “Add”, a new instance of TestClass is created using java language. 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值