|
Vc++的代码:
// vccedll.cpp : 定义 DLL 应用程序的入口点。
//
#include "stdafx.h"
#include
#include
extern "C" int add(int x,int y);
extern "C" char * sayhello();
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
int add(int x,int y)
{
return x + y;
}
char * sayhello()
{
return "hello chj!";
}
C#的代码
[DllImport("vccedll.dll")]
public static extern byte[] sayhello();
[DllImport("vccedll.dll")]
public static extern int add(int x, int y);
调用时报 如果类库中的某个方法已被移除或重命名,请重新编译引用该方法的所有程序集。
怎么回事呀,急死了!!
|
|