Home > Uncategorized > Using .NET Classes/Modules from native C++

Using .NET Classes/Modules from native C++

September 17th, 2009 Leave a comment Go to comments

The goal of this article is to describe a more or less generic way to access .NET managed object from a native C++ application.

Introduction

The goal of this article is to describe a more or less generic way to access .NET managed object from a native C++ application. I will present a dynamic link library (dll) which can be used, for example, to augment legacy C++ applications with the power of managed code. The library is written in C++/CLI which is the only .NET language which can be used to accomplish such a task.
All code was written with Visual C++ 2008, it’s also possible to do this with previous versions of the Microsoft C++ compilers, but Microsoft has done a lot of changes to C++/CLI for VS 2008, so it’s now much easier to use than in older version.
The “more” generic in the first sentence means that the library can be used to call any function (with an unlimited amount of parameters) of any managed class. The “less” means that the parameter types are limited to the native C++ types and a few user defined types (string, date/time, …). It’s easy to provide support for your own types, but therefore the code for the dll has to be extended by yourself.

continue

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.