当前位置:网站首页>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.
边栏推荐
- 中国农科院基因组所汪鸿儒课题组诚邀加入
- ByteDance dev better technology salon was successfully held, and we joined hands with Huatai to share our experience in improving the efficiency of web research and development
- I wrote a learning and practice tutorial for beginners!
- Scala基础教程--13--函数进阶
- 学习路之PHP--phpstudy创建项目时“hosts文件不存在或被阻止打开”
- Neglected problem: test environment configuration management
- Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
- [cloud native] what is the "grid" of service grid?
- TCP两次挥手,你见过吗?那四次握手呢?
- 表情包坑惨职场人
猜你喜欢
78 year old professor Huake impacts the IPO, and Fengnian capital is expected to reap dozens of times the return
I always thought that excel and PPT could only be used for making statements until I saw this set of templates (attached)
提升复杂场景三维重建精度 | 基于PaddleSeg分割无人机遥感影像
力扣刷題日記/day6/6.28
With the stock price plummeting and the market value shrinking, Naixue launched a virtual stock, which was deeply in dispute
如何提高开发质量
线上MySQL的自增id用尽怎么办?
Scala基础教程--20--Akka
蓝桥:合根植物
Just today, four experts from HSBC gathered to discuss the problems of bank core system transformation, migration and reconstruction
随机推荐
fopen、fread、fwrite、fseek 的文件处理示例
Scala基础教程--20--Akka
.NET ORM框架HiSql实战-第二章-使用Hisql实现菜单管理(增删改查)
Weima, which is going to be listed, still can't give Baidu confidence
TCP waves twice, have you seen it? What about four handshakes?
The block:usdd has strong growth momentum
Li Kou brush question diary /day5/2022.6.27
"In Vietnam, money is like lying on the street"
力扣刷题日记/day3/2022.6.25
[HCIA continuous update] WAN technology
Once the "king of color TV", he sold pork before delisting
Tutorial on the use of Huawei cloud modelarts (with detailed illustrations)
Li Kou brush question diary /day2/2022.6.24
【209】go语言的学习思想
李迟2022年6月工作生活总结
With an estimated value of 90billion, the IPO of super chip is coming
Scala基础教程--19--Actor
ITSS运维能力成熟度分级详解|一文搞清ITSS证书
Scala基础教程--16--泛型
Scala基础教程--14--隐式转换