Skip to content

CSharpToNativeC_Start

jsmith edited this page Aug 22, 2016 · 3 revisions

#C# library wrapped by C++/CLI Bridge used in Native C
The goal of this tutorial is to learn how to access and use a managed C# .Net library from the unmanaged native C world.

#Prerequisites

  1. Learn the difference between stack vs. native/unmanaged heap vs. [managed heap] (https://msdn.microsoft.com/en-us/library/ee787088(v=vs.110).aspx). All three are used in a C++/CLI library.
    • Memory allocated on the stack can be determined at compile time and does not have to be 'managed' by anyone.
    • Memory allocated on the native/unmanaged heap needs to be managed by the coder (hence unmanaged). It has to be allocated and deleted. It is good practice to avoid this type of memory allocation in C++/CLI.
    • Memory allocated on the managed heap is managed by the garbage collector. This is the primary memory managment for the .Net framework.
  2. Learn what a handle in C++/CLI is.
  3. What the #define Directive is.

#Steps

  1. Create a simple C# library
Clone this wiki locally