有一个底层的c语言代码封装的dll文件
c语言程序调用这个dll文件实现了功能
现在需要用c#给这个c语言程序做一个界面 涉及到几个问题
1.这个c语言程序包含了多个头文件,怎么把头文件放到c#程序里调用
2.怎么调用动态链接库,在项目里添加不进去尝试了如下代码
//fcApi.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
namespace fc
{
unsafe class fcApi
{
[DllImport("BQFIC_ASM_DLL.dll", EntryPoint = "FIC_DIV_Found")]
public extern static int FIC_DEV_Found(uint* Devnum);
}
}
这个是老师给的方法
3.我在主框体里放了个按钮,在点击事件里调用dll中的函数
unsafe private void button1_Click(object sender, EventArgs e)
{
BQFIC_ASM_DLL_API int FIC_DEV_Found(int* Devnum);
int dev_count = 0;
int x = FIC_DEV_Found((int *) & dev_count);
}
说“上下文中不存在名称”BQFIC_ASM_DLL_API