ArchiToolkit.CppInteropGen
2025.9.21
dotnet add package ArchiToolkit.CppInteropGen --version 2025.9.21
NuGet\Install-Package ArchiToolkit.CppInteropGen -Version 2025.9.21
<PackageReference Include="ArchiToolkit.CppInteropGen" Version="2025.9.21" />
<PackageVersion Include="ArchiToolkit.CppInteropGen" Version="2025.9.21" />
<PackageReference Include="ArchiToolkit.CppInteropGen" />
paket add ArchiToolkit.CppInteropGen --version 2025.9.21
#r "nuget: ArchiToolkit.CppInteropGen, 2025.9.21"
#:package ArchiToolkit.CppInteropGen@2025.9.21
#addin nuget:?package=ArchiToolkit.CppInteropGen&version=2025.9.21
#tool nuget:?package=ArchiToolkit.CppInteropGen&version=2025.9.21
CppInteropGen
This tool is still work in progress.
Brief
This is an easy tool to wrap the cpp file to c#.
CPP
You should include the file csharp_interop.h to your cpp project.
And Define the Macro WRAP_CALL_CUSTOM_CATCH before include the csharp_interop.h.
Use the Macro CSHARP_WRAPPER To define the method you like.
use //DLL_NAME: to define the dll name.
ust //STRUCT: to define the struct layout.
Namings
- The method name must be
%CLASSNAME%_%METHODNAME%_%EXTRA%. - And the file name must be
%CLASSNAME%_Cwith the extensionh,cpp,hxx, orcxx. - Every file must have the definitions of
CreateandDeletefor the ctor and the dtor.
Example
Define your own WRAP_CALL_CUSTOM_CATCH.
#ifndef EXPORT_MACRO_H
#define EXPORT_MACRO_H
#include <Standard_Failure.hxx>
#include <string>
#ifndef WRAP_CALL_CUSTOM_CATCH
#define WRAP_CALL_CUSTOM_CATCH \
catch (const Standard_Failure &ex) { \
const std::string typeName = ex.DynamicType()->Name(); \
const std::string message = ex.GetMessageString(); \
return copy_to_heap("OCCT [" + typeName + "]: " + message); \
}
#endif
#include <csharp_interop.h>
#endif //EXPORT_MACRO_H
Add your own methods
#include <gp_Pnt.hxx>
#include "export_macro.h"
//DLL_NAME: EXAMPLE.dll
//STRUCT: gp_XYZ.Data coord
CSHARP_WRAPPER(gp_Pnt_Create_0(gp_Pnt*& handle), {
handle= new gp_Pnt();
})
CSHARP_WRAPPER(gp_Pnt_Create_coord(const gp_XYZ& xyz, gp_Pnt*& handle), {
handle= new gp_Pnt(xyz);
})
CSHARP_WRAPPER(gp_Pnt_Create_xyz(const double x, const double y, const double z, gp_Pnt*& handle), {
handle= new gp_Pnt(x, y, z);
})
CSHARP_WRAPPER(gp_Pnt_Delete(const gp_Pnt *self), {
delete self;
})
CSHARP_WRAPPER(gp_Pnt_ChangeCoord(gp_Pnt *self, gp_XYZ*& xyz), {
xyz = &self->ChangeCoord();
})
CSHARP_WRAPPER(gp_Pnt_Distance(const gp_Pnt *self, const gp_Pnt& other, double& distance), {
distance = self->Distance(other);
})
CSHARP_WRAPPER(gp_Pnt_SquareDistance(const gp_Pnt *self, const gp_Pnt& other, double& squareDistance), {
squareDistance = self->SquareDistance(other);
})
C#
In C#, it'll generate the Wrappers for you. You can use partial keyword to add more things.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- NativeLibraryLoader (>= 1.0.13)
-
.NETFramework 4.8
- NativeLibraryLoader (>= 1.0.13)
-
.NETStandard 2.0
- NativeLibraryLoader (>= 1.0.13)
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2025.9.21 | 295 | 9/21/2025 |
| 2025.9.20 | 240 | 9/20/2025 |
| 0.9.16.23 | 355 | 9/17/2025 |
| 0.9.16.22 | 288 | 9/15/2025 |
| 0.9.16.21 | 271 | 9/15/2025 |
| 0.9.16.20 | 201 | 9/12/2025 |
| 0.9.16.19 | 221 | 9/8/2025 |
| 0.9.16.18 | 206 | 9/5/2025 |
| 0.9.16.17 | 233 | 9/1/2025 |
| 0.9.16.16 | 265 | 8/27/2025 |
| 0.9.16.15 | 241 | 8/20/2025 |
| 0.9.16.14 | 308 | 8/7/2025 |
| 0.9.16.13 | 387 | 7/21/2025 |
| 0.9.16.12 | 225 | 7/10/2025 |
| 0.9.16.11 | 154 | 7/5/2025 |
| 0.9.16.10 | 177 | 6/28/2025 |
| 0.9.16.9 | 189 | 6/27/2025 |
| 0.9.16.8 | 226 | 6/23/2025 |
| 0.9.16.7 | 225 | 6/17/2025 |
| 0.9.16.6 | 371 | 6/12/2025 |