既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上物联网嵌入式知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、电子书籍、讲解视频,并且后续会持续更新
说明:
- VS 2017 Project 生成的平台是 X 64版本,本人用VS 2019直接打开,直接编译生成DLL,不可用,不知为何,就放弃了 ,
- VS 2013 Project 生成的平台是 32 版本,直接生成可用
3,使用VS打开上面截图中的 VS 2013 Project , 我们直接打开capldll.cpp文件,然后定位到下面代码的地方:
// ============================================================================
// CAPL\_DLL\_INFO\_LIST : list of exported functions
// The first field is predefined and mustn't be changed!
// The list has to end with a {0,0} entry!
// New struct supporting function names with up to 50 characters
// ============================================================================
CAPL_DLL_INFO4 table[] = {
{CDLL_VERSION_NAME, (CAPL_FARCALL)CDLL_VERSION, "", "", CAPL_DLL_CDECL, 0xabcd, CDLL_EXPORT },
{"dllInit", (CAPL_FARCALL)appInit, "CAPL\_DLL","This function will initialize all callback functions in the CAPLDLL",'V', 1, "D", "", {"handle"}},
{"dllEnd", (CAPL_FARCALL)appEnd, "CAPL\_DLL","This function will release the CAPL function handle in the CAPLDLL",'V', 1, "D", "", {"handle"}},
{"dllSetValue", (CAPL_FARCALL)appSetValue, "CAPL\_DLL","This function will call a callback functions",'L', 2, "DL", "", {"handle","x"}},
{"dllReadData", (CAPL_FARCALL)appReadData, "CAPL\_DLL","This function will call a callback functions",'L', 2, "DL", "", {"handle","x"}},
{"dllPut", (CAPL_FARCALL)appPut, "CAPL\_DLL","This function will save data from CAPL to DLL memory",'V', 1, "D", "", {"x"}},
{"dllGet", (CAPL_FARCALL)appGet, "CAPL\_DLL","This function will read data from DLL memory to CAPL",'D', 0, "", "", {""}},
{"dllVoid", (CAPL_FARCALL)voidFct, "CAPL\_DLL","This function will overwrite DLL memory from CAPL without parameter",'V', 0, "", "", {""}},
{"dllPutDataOnePar", (CAPL_FARCALL)appPutDataOnePar, "CAPL\_DLL","This function will put data from CAPL array to DLL",'V', 1, "B", "\001", {"datablock"}},
{"dllGetDataOnePar", (CAPL_FARCALL)appGetDataOnePar, "CAPL\_DLL","This function will get data from DLL into CAPL memory",'V', 1, "B", "\001", {"datablock"}},
{"dllPutDataTwoPars", (CAPL_FARCALL)appPutDataTwoPars,"CAPL\_DLL","This function will put two datas from CAPL array to DLL",'V', 2, "DB", "\000\001", {"noOfBytes","datablock"}},// number of pars in octal format
{"dllGetDataTwoPars", (CAPL_FARCALL)appGetDataTwoPars,"CAPL\_DLL","This function will get two datas from DLL into CAPL memory",'V', 2, "DB", "\000\001", {"noOfBytes","datablock"}},
{"dllAdd", (CAPL_FARCALL)appAdd, "CAPL\_DLL","This function will add two values. The return value is the result",'L', 2, "LL", "", {"x","y"}},
{"dllSubtract", (CAPL_FARCALL)appSubtract, "CAPL\_DLL","This function will substract two values. The return value is the result",'L', 2, "LL", "", {"x","y"}},
{"dllSupportLongFunctionNamesWithUpTo50Characters", (CAPL_FARCALL)appLongFuncName, "CAPL\_DLL","This function shows the support of long function names",'D', 0, "", "", {""}},
{"dllAdd63Parameters", (CAPL_FARCALL)appAddValues63, "CAPL\_DLL", "This function will add 63 values. The return value is the result",'L', 63, "LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL", "", {"val01","val02","val03","val04","val05","val06","val07","val08","val09","val10","val11","val12","val13","val14","val15","val16","val17","val18","val19","val20","val21","val22","val23","val24","val25","val26","val27","val28","val29","val30","val31","val32","val33","val34","val35","val36","val37","val38","val39","val40","val41","val42","val43","val44","val45","val46","val47","val48","val49","val50","val51","val52","val53","val54","val55","val56","val57","val58","val59","val60","val61","val62","val63"}},
{"dllAdd64Parameters", (CAPL_FARCALL)appAddValues64, "CAPL\_DLL", "This function will add 64 values. The return value is the result",'L', 64, {SixtyFourLongPars}, "", {"val01","val02","val03","val04","val05","val06","val07","val08","val09","val10","val11","val12","val13","val14","val15","val16","val17","val18","val19","val20","val21","val22","val23","val24","val25","val26","val27","val28","val29","val30","val31","val32","val33","val34","val35","val36","val37","val38","val39","val40","val41","val42","val43","val44","val45","val46","val47","val48","val49","val50","val51","val52","val53","val54","val55","val56","val57","val58","val59","val60","val61","val62","val63","val64"}},
{0, 0}
};
关键参数说明
1,这是CAPL编程DLL的唯一不同点就是需要配置这个Table,搞定这个,CAPL的DLL编程和一般C++的DLL编程有没什么区别,这里其它参数逗号理解,可能就倒数第二个参数 “参数维度”这个特殊一点,下面举例说明下。
2,Table的数据类型参数简称和CAPL,C++数据类型对照图。
3,实例 - 1 (参数是标量)
当参数是标量时,下面的这个例子,没有返回值,所以函数返回值是“V”,有一个 unsigned long 标量,所以对应的参数类型是“D”,因为是标量,所以维度是0,即“\000”
4,实例 - 2(参数是数组)
这个实例函数没有返回值,返回值参数是“V”;前后有两个参数,第一个是unsigned long 标量,所以对应的参数类型是“D”,因为是标量,所以维度是0,即“\000” ;第二个参数是一维unsigned char数组,所以对应的参数类型是“B”,维度参数是“\001” ;
5,实例 - 3 (参数是引用*)
-在从CAPL dll导出的函数中也可以使用引用参数。因此必须将函数的参数声明为实际数据类型上的指针。之后,从CAPL导出表中表示数据类型的字符中减去128。然后函数接收传递的变量的地址作为参数的值
总结
- 如上就是这篇博客的内容了,CAPL虽然较为封闭,但是留的编程接口很多,可以C++,C#,.NET,Python等等,如果能够很好的用好DLL编程,可以把你的核心算法或者脚本封装在DLL中,在给客户提供cases是,可以有效保护你的代码安全;而且C++的函数库要比CAPL强大的多。
收集整理了一份《2024年最新物联网嵌入式全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升的朋友。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人
都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
8679757)**
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人
都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!