This project is a Windows 10 solution using Visual Studio 2019, which calls the C++ interfaces from flexiv_rdk via P-Invoke and wraps them with some C# interfaces. The FlexivRdkCSharp folder contains a C# project, with the Examples folder housing example programs that utilize the interfaces from FlexivRdk. The FlexivRdk folder contains the C# wrappers for these interfaces, which call the functions from FlexivRdkDll. The Program.cs file is the test program, which uses examples from the Examples folder. The FlexivRdkDll folder is a C++ project that wraps the C++ interfaces from flexiv_rdk and generates a dynamic library from its static library. The ReleaseDll folder contains the precompiled dynamic libraries.
To use the current C# project, simply use the .cs files from the FlexivRdkCSharp/FlexivRdk folder and place the dynamic libraries from the ReleaseDll folder in the directory where the generated C# .exe file is located. The project has already set the output paths of FlexivRdkCSharp and FlexivRdkDll to the same folder, with FlexivRdkCSharp set as the startup project. Building FlexivRdkDll will generate the required dynamic libraries. In its project settings, you can replace the C/C++ additional include directories, linker additional library directories, and additional dependencies with your own local settings. Users can extend the interfaces as needed.
本项目是一个Windows10下Visual Studio 2019的解决方案,使用P-Invoke方式调用flexiv_rdk中的C++接口,封装了一些C#接口。FlexivRdkCSharp文件夹是一个C#项目,其中Examples文件夹下是示例程序,使用FlexivRdk中的接口。FlexivRdk文件夹下是封装的C#接口,调用FlexivRdkDll中的接口。Program.cs是测试程序,使用Examples中的例程。FlexivRdkDll文件夹是一个C++项目,用于包装flexiv_rdk的C++接口,根据其静态库生成动态库。ReleaseDll文件夹下包含已经编译好的动态链接库。
当前C#项目直接使用FlexivRdkCSharp/FlexivRdk文件夹下的.cs文件,将ReleaseDll下的动态链接库放到当前C#生成.exe文件的目录,即可运行。当前项目已将FlexivRdkCSharp和FlexivRdkDll输出路径设置为同一个文件夹,将FlexivRdkCSharp设为启动项目。对FlexivRdkDll生成会得到所需的动态链接库,在其项目属性中可以将C/C++附加包含目录,链接器中的附加库目录和附加依赖项中的配置项换成自己的本地设置。用户可以自行扩展所需要的接口。