https://github.com/skivhisink/marshalingclrsamples
Guide for Using C++ or C code in C#
https://github.com/skivhisink/marshalingclrsamples
clr cpp csharp dll library marshaling
Last synced: about 2 months ago
JSON representation
Guide for Using C++ or C code in C#
- Host: GitHub
- URL: https://github.com/skivhisink/marshalingclrsamples
- Owner: SkivHisink
- License: mit
- Created: 2023-08-05T08:44:55.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-05T11:37:44.000Z (almost 3 years ago)
- Last Synced: 2025-04-09T01:48:40.718Z (about 1 year ago)
- Topics: clr, cpp, csharp, dll, library, marshaling
- Language: C#
- Homepage:
- Size: 104 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MarshalingCLRSamples
This repository contains examples of using С++ code in С#.
The following two common approaches are typically employed:
* [**Marshaling**](https://github.com/SkivHisink/MarshalingCLRSamples/blob/main/README.md#marshaling)
* [**CLR**](https://github.com/SkivHisink/MarshalingCLRSamples/blob/main/README.md#clr)
## Marshaling
### About
Marshaling is the process of converting data between different memory representations to enable communication between components with different data formats, such as managed and unmanaged code in software applications. It allows seamless data exchange by translating data structures, data types, and memory layouts to ensure compatibility and consistency during interoperation. Marshaling is commonly used in environments like .NET to facilitate communication between managed and unmanaged code and to handle data transfers across boundaries like processes or networks.
### How to
1. Create Project with **DLL** Configuration type.

2. TODO
### Code samples
## CLR
### About
C++ to C# communication via CLR (Common Language Runtime) can be achieved by creating a managed C++ wrapper that exposes C++ functions to the .NET environment. The managed C++ wrapper serves as an intermediary, allowing C# code to call C++ functions seamlessly. This integration enables interoperability between C++ and C# codebases, leveraging the strengths of both languages in a single application.
### How to
It will be written later.
### Code samples
TODO