在Visual Basic 2013中使用C(或C ++).dll文件 [英] Using a C (or C++) .dll file in Visual Basic 2013

查看:87
本文介绍了在Visual Basic 2013中使用C(或C ++).dll文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我们目前正在尝试编写Windows应用程序,以通过USB端口将命令/数据发送到外部Eval PCB上的IC.该PCB是用于将USB转换为SPI(串行外围接口)的IC的评估板.评估板公司 提供了.dll,.cs和.h及其工具.他们还说.dll文件是用C导出"的.

We are presently trying to write a Windows application to send commands/data through a USB port to an IC on an external Eval PCB.  This PCB is an Eval board for an IC that converts USB to SPI (Serial Peripheral Interface).  The Eval board company provided a .dll, .cs and a .h with their tools.  They also stated that the .dll file was"exported in C".

我真的对C语言一无所知,因此我对如何在最终的Windows应用程序(将使用Visual Basic编写)中使用.dll文件一无所知.

I'm really do not have a clue about the C language so I'm at a loss as how to use the .dll file in my eventual Windows app, which will be written in Visual Basic.

.cs文件可能是C#文件,但我也不确定.

It is possible the .cs file is a C# file but I'm not sure about that either.

我尝试做的一件事是将.dll文件作为参考导入到我的Windows应用程序项目中,但出现错误:对"C:.../xx.dll的引用";无法添加.请确保该文件可访问并且是有效的程序集 或COM组件".

One thing I did try was to bring the .dll file into my Windows app project as a Reference but I got an error: "A reference to "C:.../xx.dll" could not be added.  Please make sure that the file is accessible and that it is a valid assembly or COM component".

那么,一个人(甚至不是Visual Basic的专家)如何尝试使用此.dll文件?我什至不知道在这里问什么问题...

So how does one (who is not really even an expert in at Visual Basic) go about trying to use this .dll file?  I'm not even sure what questions to ask here...

感谢您提供的任何帮助.

Thanks for any help you can give.

推荐答案

那么,一个人(甚至不是Visual Basic的专家)如何尝试使用此.dll文件?我什至不知道在这里问什么问题...

So how does one (who is not really even an expert in at Visual Basic) go about trying to use this .dll file?  I'm not even sure what questions to ask here...

我首先要求制造商确认它是一个.Net DLL(应该是).

I would start by asking the manufacturer to confirm that it is a .Net DLL (it should be).

如果您使用提供的.DLL,则无需重新编译它,因此不需要.CS和.H文件.但是,如果.DLL是C而不是C#,则接口连接可能会变得更加复杂.但是通常,此过程是添加DLL. 参考您的VB项目.使用导入..."语句简化您的函数引用.然后创建您的对象并根据需要访问它们的方法.

If you use the .DLL they provided there should be no need to re-compile it so the .CS and .H files are not needed.   However, if the .DLL is C and not C# then interfacing might get more complex. But in general the process is to add the DLL to your VB project as a reference.  Use an Imports ... statement to simplify your function references.  Then create your objects and access their methods as rquired.


这篇关于在Visual Basic 2013中使用C(或C ++).dll文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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