C#调用C/C++ dll问题
C/C++ DLL里的函数定义:
extern "C" __declspec(dllexport) int __stdcall pfs_login (char request[], char response[],int bufSize, char address[]);
response是输出参数,其他的全部是输入参数
在c#里怎么调用这个dll,不知道怎么写。谢谢。
[DllImport("OUR_MIFARE.dll")]
static extern int pfs_login(char request[], char response[],int bufSize, char address[]);
可能这样吧~
对于 DllImport声明外部方法,有时候要指明EntryPoint,我也不是很懂
用委托
兄弟,嫩不能具体点?
参考:
http://blog.csdn.net/pansiom/archive/2006/01/01/568096.aspx
[DllImport("OUR_MIFARE.dll")]
static extern int pfs_login(char request[], char response[],int bufSize, char address[]);
把DLL名字改成你的dll 然后就能直接使用你自己写的这个方法了呀 pfs_login(参数);
c#可以这样写?保存都出现下面的错误
Error 1 Array type specifier, [], must appear before parameter name D:\TestLink by Maximm\TestLink\Form1.cs 21 49 TestLink
extern "C" __declspec(dllexport) int __stdcall pfs_login (char request[], char response[],int bufSize, char address[]);
[DllImport("你的DLL名字.dll")]
pfs_login(string request, ref string response, int bufSize, string address);
extern "C" __declspec(dllexport) int __stdcall pfs_login (char request[], char
相关问答:
最近在看一个用bison实现的C parser,OS是opensolaris。当用它来解析一个简单的hello.c时,出现“/usr/include/sys/va_list.h: parse error before __gnuc_va_list”。打开文件va_list.h后发现这样一行“typedef __bu ......
#include "stdio.h"
int main()
{
char *ch(char *, char *);
char str1[]="I am glad to meet you!";
char str2[]="Welcom to study C!";
&nb ......
#include"stdio.h"
#include"stdlib.h"
void ContrTwo(char i)
{
char str1[8];
itoa(i,str1,2);
printf("%s",str1);
}
unsigned char leftRot(char str,int i);
unsign ......
在数据库中有张表,有id,name两列,id 是主键,没有设置自增属性,在程序中取出这张表放入datatable,在这个datatable中插入一条记录,当更新数据库时提示id列不能为空,请问该怎么解决?
给它一个值!!主键不能为空 ......
两个文件1.PC,1.inc
1.PC有操作oracle数据库的 ,1.inc也有操作oracle数据库
在其他数据中如informix 中$include 1.inc就可以使用了
在ORACLE数据库重 $include 1.inc不可用 EXEC SQL include 1.inc也不可 ......