当前位置:网站首页>Pb extended DLL development (super chapter) (VII)
Pb extended DLL development (super chapter) (VII)
2022-07-04 18:44:00 【lxbin2003】
PB An extension of DLL Development ( Super )( 7、 ... and )
(PB The first open development technology in history )
Object instantiation and destruction
Suppose there is PB This is the code :
uo_json js
js = create uo_json
DLL The code that implements the same function in is :
OB_INST_ID obInstID = NULL;
if (rt_create_obinst(obThis, (LPTSTR)_T(“uo_json”), &obInstID) == 1)
{
// Instantiation successful
}
If you want to return the instance to PB
OB_DATA obReturn = {0};
OB_CLASS_HNDL hndl = ob_get_obinst_class_hndl(obThis, obInstID);
OB_CLASS_ID classID = hndl.class_id ; // Get its type
ob_set_data_obinst(&obReturn, obInstID, classID, OB_INSTVAR_FIELD);
if(obInstID == NULL)
ob_set_info_nullval(obReturn .info, TRUE); // If the creation fails , It's a null value , To put NULL Mark , In this way PB In the use isnull() or isvalid() When judging, it will be false
ot_set_return_val(obThis, &obReturn); // Return object instance
Other functions that can instantiate objects are :
ob_create_obinst
ot_create_obinst_with_name
ot_create_obinst_at_lval
ob_create_object
ob_create_object_using
Yes ot_ The beginning and ob_ Initial function ,ot_ The beginning should be runtime Class function , Than ob_ The beginning should be more advanced , It is recommended to use ot_ Initial function .
After an object instance , Return to PB Environmental Science , You can explicitly destroy js, If you don't write destroy Code ,PB It will also automatically Destroy it .
DLL It can be destroyed by itself
ob_destroy_obinst(obThis,obInstID);
it is to be noted that , PB The code doesn't know you DLL Inside has been destroyed , Will continue to destroy , Cause program crash . therefore , You don't usually need to call ob_destroy_obinst This destruction function .
I'm thinking : This destruction leads to a crash , It should be related to the reference count . Only if its reference count is 0 when , Will really destroy . There's a function rtDataCopy Its last parameter indicates whether to increase the reference count . If it is an incoming parameter , We can use rtDataCopy Copy one for your own use , You can use it up ob_destroy_obinst, It won't break down . unfortunately , I can't find where to add this reference count directly . If you know something, please tell me , I can fill this hole .(*(DWORD*)((DWORD)obInstID + 24)) ++; It can increase the count 1, But I dare not use , Still have SDK Functions are more secure to use .
The above is about invisible objects and instantiation and destruction . As for visualization objects , Still PB Drag and drop with the mouse in the design environment ,DLL It is very complicated to implement , I haven't mastered , Not here .
If you are right about system library Interested in relevant development methods , Accessible QQ Group 624409252 Download from the special directory in the sharing DEMO.
边栏推荐
- Redis主从复制
- 基于NCF的多模块协同实例
- With the stock price plummeting and the market value shrinking, Naixue launched a virtual stock, which was deeply in dispute
- Scala基础教程--18--集合(二)
- 同事悄悄告诉我,飞书通知还能这样玩
- 力扣刷题日记/day8/7.1
- Scala基础教程--14--隐式转换
- Li Kou brush question diary /day4/6.26
- 6.26CF模拟赛B:数组缩减题解
- [cloud native] what is the "grid" of service grid?
猜你喜欢

DB-Engines 2022年7月数据库排行榜:Microsoft SQL Server 大涨,Oracle 大跌

The block:usdd has strong growth momentum
![[go language question brushing chapter] go conclusion chapter | introduction to functions, structures, interfaces, and errors](/img/7a/16b481753d7d57f50dc8787eec8a1a.png)
[go language question brushing chapter] go conclusion chapter | introduction to functions, structures, interfaces, and errors

How is the entered query SQL statement executed?

用于图数据库的开源 PostgreSQL 扩展 AGE被宣布为 Apache 软件基金会顶级项目

Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers

2022年全国CMMI认证补贴政策|昌旭咨询

An example of multi module collaboration based on NCF

Digital "new" operation and maintenance of energy industry

力扣刷題日記/day6/6.28
随机推荐
6.26CF模拟赛B:数组缩减题解
线上MySQL的自增id用尽怎么办?
怎么开户才是安全的,
Tutorial on the use of Huawei cloud modelarts (with detailed illustrations)
【云端心声 建议征集】云商店焕新升级:提有效建议,赢海量码豆、华为AI音箱2!
Li Kou brush question diary /day7/6.30
爬虫(6) - 网页数据解析(2) | BeautifulSoup4在爬虫中的使用
Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
Nature microbiology | viral genomes in six deep-sea sediments that can infect Archaea asgardii
Scala基础教程--20--Akka
Scala基础教程--13--函数进阶
Li Kou brush question diary /day6/6.28
Unity 制作旋转门 推拉门 柜门 抽屉 点击自动开门效果 开关门自动播放音效 (附带编辑器扩展代码)
Imitation of numpy 2
力扣刷题日记/day5/2022.6.27
Halcon模板匹配
An example of multi module collaboration based on NCF
With an estimated value of 90billion, the IPO of super chip is coming
力扣刷题日记/day7/6.30
【2022年江西省研究生数学建模】水汽过饱和的核化除霾 思路分析及代码实现