如何在CANoe / CAPL中包含.h或.dll文件 [英] How to include a .h or .dll file in CANoe/CAPL

查看:778
本文介绍了如何在CANoe / CAPL中包含.h或.dll文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在CAPL中集成标头.h或.dll文件(具体是Visa32.dll,visa.h或sicl.h),以控制万用表34461A。如何在CANoe中包含.h文件或.dll文件?
我创建了一个称为万用表的ECU模块。谢谢,

I want integrate a header .h or .dll file in CAPL (concretly Visa32.dll, visa.h or sicl.h) to control a multimeter 34461A. How can I include the .h files or .dll file in CANoe? I created an ECU module called multimeter. Thanks,

推荐答案

可以在CAPL中包含外部DLL,但是您将需要为所有要创建的功能创建包装器

Including external DLLs in CAPL is possible, but you will need to create a wrapper for all the functions you're going to use.

看看 \CANoe\Demo_AddOn\Capldll 目录,它具有包装纸。这是一个MSVC项目,可将一些简单功能导出到CAPL,例如 int f(int a,int b){return a + b;}

Take a look at \CANoe\Demo_AddOn\Capldll directorty which features such a wrapper. It's a MSVC project exporting a few simple functions to CAPL, like int f(int a, int b) {return a+b;}.

您需要做的是将库文件(Visa32.dll,visa.h)添加到此Capldll项目,并为要从CANoe调用的所有函数定义包装器。例如,如果您在Visa32.dll中具有 int visa_init(double arg),则将创建一个包装器:

What you will need to to is to add your library files (Visa32.dll, visa.h) to this Capldll project and define wrappers for all the functions you want to call from CANoe. For example, if you have int visa_init(double arg) in Visa32.dll, you will create a wrapper:

int CAPLEXPORT far CAPLPASCAL capl_visa_init(double arg)
{
    return visa_init(arg);
}

您还需要将函数原型添加到导出表中:

You will also need to add the prototype of your function to the export table:

CAPL_DLL_INFO CAPL_DLL_INFO_LIST[] =
{
    {"my_visa_init", (CAPL_FARCALL)capl_visa_init, 'D', 1, "F", "\000"},
    ....
    {0,0}
}; 

一旦成功构建包装DLL(如果重用示例,它将称为capldll.dll。 ),则需要将其导入CANoe,并且可以使用在导出表中定义的名称来调用该函数,例如 my_visa_init(1.0);

Once you have successfully build your wrapper DLL (it will be called capldll.dll if you reuse the example), you will need to import it in CANoe, and you will be able to call the function by the name you defined in the export table, e.g. my_visa_init(1.0);

这篇关于如何在CANoe / CAPL中包含.h或.dll文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆