question on Managed code

A

achutha.sridhar

I've a pretty basic question on managed code. I read through couple
of.net documentation, and reached a state where I know that managed
code would be run by the .Net run time and it has so and so
advanantages

My question is if I've a unmanaged custom dll(say a.dll) built using
VC++ 6.0 and if I were to create a wrapper class in .Net(say b.dll) to
invoke the unmanaged dll, will my b.dll become a managed code or still
it is unmanaged? As per my understanding b.dll is managed as it is
running under the .Net environment?

When people say my code is 100% managed code, then do they mean they
have written and used everything written under a .Net environment?
 
R

Robbe Morris [C# MVP]

Your b.dll is still managed but you are calling unmanaged code.
Thus, you haven't altered the overall environment.
 
C

Chris Mullins

My question is if I've a unmanaged custom dll(say a.dll) built using
VC++ 6.0 and if I were to create a wrapper class in .Net(say b.dll) to
invoke the unmanaged dll, will my b.dll become a managed code or still
it is unmanaged? As per my understanding b.dll is managed as it is
running under the .Net environment

Your DLL would not be running managed code. It would be called from .Net
using an Interop and all calls to and from your DLL would incur a
performance penalty as .Net continually makes security checks.
When people say my code is 100% managed code, then do they mean they
have written and used everything written under a .Net environment?

That's pretty much exactly what they mean..
 
C

Cor Ligthert [MVP]

Achutha,

In addition to the other messages, a 100% Net environment is only using
classes from the .Net System or the .Net Micorosoft.Visual.Basic namespace,
those are all creating managed code.

An added DLL (Com) can be used very fine, but those have to be on the client
computer as well, while in the above situation there only has to be the .Net
redistribute

Cor
 
S

Scott M.

The RCW (runtime callable wrapper) WOULD be managed code, but it would be
invoking the un-managed COM component.
 
W

Willy Denoyette [MVP]

| I've a pretty basic question on managed code. I read through couple
| of.net documentation, and reached a state where I know that managed
| code would be run by the .Net run time and it has so and so
| advanantages
|
| My question is if I've a unmanaged custom dll(say a.dll) built using
| VC++ 6.0 and if I were to create a wrapper class in .Net(say b.dll) to
| invoke the unmanaged dll, will my b.dll become a managed code or still
| it is unmanaged? As per my understanding b.dll is managed as it is
| running under the .Net environment?
|
b.dll is managed code when built using a pure managed code compiler.


| When people say my code is 100% managed code, then do they mean they
| have written and used everything written under a .Net environment?
|

No they mean that their code was build using a "pure managed code" compiler
producing "Verifiable IL", like tere are C# and Vb.Net. VC 7.x and VC8.x can
build "pure managed code" assemblies, but they can also produce mixed code
assemblies, these are NOT pure managed assemblies, they contain native code
blobs, that means they are NOT Verifiable.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top