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);
本文介绍了如何在Code blocks中创建DLL,然后详细阐述了如何在C#项目中导入并使用该DLL,以调用定义的函数test。
532

被折叠的 条评论
为什么被折叠?



