Register  -  Login
Current Page:  Coding Fun
 Search
Google
 
 
 
 
Author: gmon Created: 5/13/2007 12:13 PM
Coding in the .NET world

Managed Wrappers
By gmon on 6/17/2007 7:10 AM
Let’s recap what we know about interoperating with legacy code from .NET.  We basically have two methods.

If the legacy code is in the form of a DLL, we can use P/Invoke from any .NET language.  We can also use C++ Interop if we are using C++/CLI to access this DLL.

If the legacy code is in the form of a C/C++ source file, then we can use C++ Interop to access it.

No matter which method we choose to interoperate with legacy code, we should consider wrapping up our work into a package that will be useable from any of the .NET languages.  This technique involves creating a managed wrapper that acts as a proxy for the legacy native code.

Once this is done, the legacy code will then be available to any other .NET language as a .NET class.  So, we tradeoff some more work in the beginning for less work further down the line.

For example, suppose our legacy code is already in the form o ...
More...

Value Types, Reference Types, Boxing and Unboxing
By gmon on 6/8/2007 2:13 AM

Most of the .NET literature I've come across reads somewhat easily because it is so similar to Java and I had already taken several Java classes.


But one of the things that I find confusing in the .NET literature is their talk of boxing and unboxing and their emphasis on Value Types and Reference Types.  I couldn't remember a similar topic in Java.  What I do remember from Java was that ...

More...

Using C++ Interop to access Legacy code
By gmon on 6/2/2007 11:42 PM

C++ Interop, also known as “It Just Works”, is only available if you are using C++/CLI.  It is my preferred way of accessing legacy C/C++ code.  The basic idea is that things should work as they have always worked before .NET came along.  In other words, if you want to access functions within a DLL from C++/CLI, you perform the same steps as if you were using Visual C++ 6.0.


To illustrate how this is done, suppose you have access to a legacy library packaged in a DLL called MathDLL.dll.  This is the same library that I used earlier to illustrate how to use P/Invoke to access functions in a DLL.


Now suppose you use Visual Studio 2005 to create a ne ...

More...

Accessing Legacy Code with P/Invoke
By gmon on 5/19/2007 6:21 PM

In 2002, Microsoft introduced a new programming framework called the .NET Framework. Programs written in any .NET language are compiled to an intermediate code called the Microsoft Intermediate Language (MSIL) and this intermediate code is run on top of something called the Common Language Runtime (CLR). The .NET Framework also includes a large set of prewritten classes called the Framework Class Library.

 

The Microsoft Intermediate Language, C ...

More...

 
 
 
Privacy Statement  |  Terms Of Use  |  Copyright 2007 by GmonWeb