1、在Code blocks 工程头文件里加上(如果没有)
- #ifdef __cplusplus
- #define EXPORT extern "C" __declspec (dllexport)
- #else
- #define EXPORT __declspec (dllexport)
- #endif // __cplusplus
在c文件里实现
int EXPORT test( int a );
2、在C#中引入DLL,digest.dll 为动态链接库名称,test为引入的函数名
[System.Runtime.InteropServices.DllImport("digest.dll", EntryPoint = "test")]
static extern int test(int a);