当前位置:网站首页>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.
边栏推荐
- Wireshark packet capturing TLS protocol bar displays version inconsistency
- With the stock price plummeting and the market value shrinking, Naixue launched a virtual stock, which was deeply in dispute
- 力扣刷题日记/day7/2022.6.29
- "In Vietnam, money is like lying on the street"
- Microservice architecture debate between radical technologists vs Project conservatives
- Wanghongru research group of Institute of genomics, Chinese Academy of Agricultural Sciences is cordially invited to join
- You should know something about ci/cd
- Halcon template matching
- 一、C语言入门基础
- MySQL常用增删改查操作(CRUD)
猜你喜欢
力扣刷题日记/day6/6.28
ISO27001 certification process and 2022 subsidy policy summary
爬虫初级学习
被忽视的问题:测试环境配置管理
力扣刷题日记/day7/6.30
NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
celebrate! Kelan sundb and Zhongchuang software complete the compatibility adaptation of seven products
Scala基础教程--20--Akka
输入的查询SQL语句,是如何执行的?
Li Kou brush question diary /day2/2022.6.24
随机推荐
【2022年江西省研究生数学建模】冰壶运动 思路分析及代码实现
Deleting nodes in binary search tree
I always thought that excel and PPT could only be used for making statements until I saw this set of templates (attached)
[HCIA continuous update] WAN technology
输入的查询SQL语句,是如何执行的?
Halcon模板匹配
李迟2022年6月工作生活总结
SIGMOD’22 HiEngine论文解读
Mysql5.7 installation tutorial graphic explanation
vbs或vbe如何修改图标
Lua EmmyLua 注解详解
.NET ORM框架HiSql实战-第二章-使用Hisql实现菜单管理(增删改查)
力扣刷题日记/day2/2022.6.24
Digital "new" operation and maintenance of energy industry
[209] go language learning ideas
Li Kou brush question diary /day8/7.1
中国农科院基因组所汪鸿儒课题组诚邀加入
Summary of subsidy policies across the country for dcmm certification in 2022
力扣刷题日记/day1/2022.6.23
Detailed explanation of the maturity classification of ITSS operation and maintenance capability | one article clarifies the ITSS certificate