我用C#做网站,需要调用dll,在App_Code中添加新项,命名为Hbme.cs,写入代码如下:
using System;
using System.Runtime.InteropServices;
/// <summary>
///
/// </summary>
public class Hbme
{
[DllImport("hbme", CallingConvention = CallingConvention.StdCall)]
public static extern bool HBME_InitDev(string com, int baudrate, int st);
[DllImport("hbme", CallingConvention = CallingConvention.StdCall)]
public static extern int HBME_CheckDev();
.........
//DLL_EXPORT int __stdcall HBME_QuitSuccess();
[DllImport ("hbme", CallingConvention = CallingConvention .StdCall) ]
public static extern void HBME_SoftPutDown( int line );
public Hbme()
{
//
// TODO: Add constructor logic here
//
}
}
在Default.aspx.cs中调用Hbme.cs中的函数,却发生以下错误,这是为什么?
编译器错误信息: CS0103: 当前上下文中不存在名称“Hbme”
源错误:
行 28: int a;
行 29: string port;
行 30: a = Hbme.HBME_EnumDevices();
行 31: if (a < 0)
行 32: {