赞
踩
C:\Users\Public\Documents\Vector\CANoe\Sample Configurations 16.0.145\Programming\CAPLdll\VS 2017 Project
找到工程文件,运行
项目->属性->C/C++/代码生成中,结构体对齐,改为默认(或许会报错)
平台选择WIN32,64位capl报错cannot open
根据配置的路径找到DLL
创建inc、src、lib文件夹
将capldll的include文件放进inc里,capldll.cpp文件放到src里面
在src文件夹中编写自己的代码,右键添加到项目中
1)(capldll.cpp,保留class CaplInstanceData的内容,capl的demo可以删除appinit等,)
2)添加自己的头文件,添加自己的函数(格式如下)
- void CAPLEXPORT CAPLPASCAL DemoCom(const void *data, uint32 length, uint8 *digest)
- {
- test(data, length, digest);
- }
3)加入列表
- CAPL_DLL_INFO4 table[] = {
- {CDLL_VERSION_NAME, (CAPL_FARCALL)CDLL_VERSION, "", "", CAPL_DLL_CDECL, 0xabcd, CDLL_EXPORT },
- {"dlldemo1", (CAPL_FARCALL)DemoCom1, "CAPL_DLL", "iam test", 'V', 3, "BDC", "\001\000\001", {"data","length","digest"}},
- {"dlldemo2", (CAPL_FARCALL)DemoCom2, "CAPL_DLL", "iam test", 'L', 1, "C", "\001", {"cert"}},
- {"dlldemo3", (CAPL_FARCALL)DemoCom3, "CAPL_DLL", "iam test", 'L', 3, "CDC", "\001\000\001", {"challenge","challengesize","sign"}},
- {0, 0}
- };
- CAPLEXPORT CAPL_DLL_INFO4* caplDllTable4 = table;
- #ifdef __cplusplus
- extern "C" {
- #endif
- /*...*/ void md5Compute(const void* data, uint32_t length, uint8_t* digest);
- #ifdef __cplusplus
- }
- #endif
CANoe不能在DLL中运行太久(ms级),否则导致overrun或者停止工程运行等情况
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。