what is shim?  
Author Message
ChitownDotNet





PostPosted: Common Language Runtime, what is shim? Top

This term is new to me. What does it mean

Thanks



.NET Development6  
 
 
nobugz





PostPosted: Common Language Runtime, what is shim? Top

It is a generic term for any piece of code, usually in a DLL, that acts as an intermediary between two incompatible systems. A typical use for a shim is to make an unmanaged DLL usable to a .NET program. It would present a managed class interface to the .NET project and translate managed method calls to native method calls, marshaling the method arguments as needed.


 
 
ChitownDotNet





PostPosted: Common Language Runtime, what is shim? Top

Wouldn't Interop perform the same function Why would one use a Shim

Also If I have some win32 API objects, Can i write a wrapper in VS .NET 2003/2005 to this win32 api without using Interop


 
 
nobugz





PostPosted: Common Language Runtime, what is shim? Top

Sure, you could use P/Invoke to call the native function. But that's error prone and not very OOP. You'll have to use a wrapper (shim) if you try to re-use a native C++ class, .NET cannot instantiate them.

You can write a wrapper without P/Invoke if you use the C++ compiler.


 
 
SalvaPatuel





PostPosted: Common Language Runtime, what is shim? Top

The shim on .NET is the mscoree.dll and is the responsible to assign you the correct .NET version when you host the CLR.

Cheers