CodePorting.Translator.Cs2Cpp.Control
23.7.0
See the version list below for details.
dotnet add package CodePorting.Translator.Cs2Cpp.Control --version 23.7.0
NuGet\Install-Package CodePorting.Translator.Cs2Cpp.Control -Version 23.7.0
<PackageReference Include="CodePorting.Translator.Cs2Cpp.Control" Version="23.7.0" />
paket add CodePorting.Translator.Cs2Cpp.Control --version 23.7.0
#r "nuget: CodePorting.Translator.Cs2Cpp.Control, 23.7.0"
// Install CodePorting.Translator.Cs2Cpp.Control as a Cake Addin #addin nuget:?package=CodePorting.Translator.Cs2Cpp.Control&version=23.7.0 // Install CodePorting.Translator.Cs2Cpp.Control as a Cake Tool #tool nuget:?package=CodePorting.Translator.Cs2Cpp.Control&version=23.7.0
Description
CodePorting.Translator Cs2Cpp is a framework capable of translating C# code to C++. The resulting code provides the same API original .Net code had and can run in the translator (unmanaged) C++ environment.
CodePorting.Translator.Cs2Cpp.Control package makes it possible to fine-tune the translated code. There are two ways to do so: attributes and service classes.
Attributes
The attributes defined in the CodePorting.Translator.Cs2Cpp.Control package are recognized by the code translator and affect how the output code looks. It is possible to remove, stub or rename members, use weak pointers instead of shared pointers, move arrays from heap to stack, alter inheritance scheme, change includes list, add C++-specific declarations (such as friend class, constexpr field or const method) and so on. To use these attributes, add reference to this package into the project being translated and use the attributes in the code. See the Attributes guide for more details.
Service classes
There are several service classes provided in the CodePorting.Translator.Cs2Cpp.Control package that may be used in the original C# code. When this code gets translated to C++, the translator replaces calls into these classes with calls into C++-specific versions of them, thus providing the means of inserting the C++-specific operations into the C# code. For example, the MemoryManagement
class provides the ways to control the lifetime of objects in C++ (this should only be used occasionally, where the default translation doesn't work well) without doing any changes to C# code behavior. The Translator
class provides the means to check if the code is being executed in C# or C++. Based on the result, one can choose an appropriate logic at runtime. See The Memory management model for more details.
Usage
Make your project depend on CodePorting.Translator.Cs2Cpp.Control:
<PackageReference Include="CodePorting.Translator.Cs2Cpp.Control" Version="*" />
Now you can use the attributes and service classes from your code:
using System;
using CodePorting.Translator.Cs2Cpp;
namespace MyProject
{
public abstract class MyClass
{
[CppWeakPtr, CppMutable]
private MyClass Parent;
[CppConstMethod]
public void DoSomething()
{
Parent = this;
if (Translator.IsTranslated)
PerformCppSpecificOperations();
else
PerformCsSpecificOperations();
}
protected abstract void PerformCppSpecificOperations();
protected abstract void PerformCsSpecificOperations();
}
}
Now, when you use the CodePorting.Translator Cs2Cpp to translate your project to C++, the translator will recognize the attributes or service classes and generate the code accordingly.
Resources
- Website: www.codeporting.com
- Product Home: CodePorting.Translator Cs2Cpp
- Download: Install CodePorting.Translator Cs2Cpp
- Documentation: CodePorting.Translator Cs2Cpp Documentation
- Free Support Forum: CodePorting.Translator Cs2Cpp Free Support Forum
- Blog: CodePorting.Translator Cs2Cpp Blog
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net35 is compatible. net40 was computed. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.7.2
- 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 |
---|---|---|
24.12.0 | 0 | 12/18/2024 |
24.11.0 | 88 | 11/19/2024 |
24.10.0 | 98 | 10/17/2024 |
24.9.0 | 125 | 9/16/2024 |
24.8.0 | 123 | 8/20/2024 |
24.7.0 | 106 | 7/12/2024 |
24.6.0 | 114 | 6/19/2024 |
24.5.0 | 99 | 5/16/2024 |
24.4.0 | 129 | 4/18/2024 |
24.3.0 | 133 | 3/14/2024 |
24.2.0 | 120 | 2/16/2024 |
24.1.0 | 143 | 1/19/2024 |
23.12.0 | 171 | 12/20/2023 |
23.11.0 | 165 | 11/17/2023 |
23.10.0 | 171 | 10/13/2023 |
23.9.0 | 143 | 9/16/2023 |
23.8.0 | 246 | 8/15/2023 |
23.7.0 | 190 | 7/18/2023 |
23.6.0 | 208 | 6/16/2023 |
23.5.0 | 190 | 5/19/2023 |
23.4.0 | 234 | 4/13/2023 |
23.3.0 | 285 | 3/20/2023 |
23.2.0 | 3,167 | 2/15/2023 |
23.1.0 | 327 | 1/20/2023 |
22.12.0 | 355 | 12/16/2022 |
22.11.0 | 441 | 11/15/2022 |
22.10.0 | 467 | 10/13/2022 |
22.9.0 | 535 | 9/14/2022 |
22.8.0 | 460 | 8/16/2022 |
22.7.0 | 462 | 7/19/2022 |
22.6.0 | 461 | 6/16/2022 |