Managed/Unmanaged code

A

AA2e72E

I am trying to understand this; I have a question.

I understand these statements are true:

1. Managed code is code that is executed by the CLR.
2. Managed code can access managed and unmanaged data.

How would I describe a C# Interrop DLL? As managed code? (It will be used by
an un-managed code (non .NET) client).
 
L

Lasse Vågsæther Karlsen

AA2e72E said:
I am trying to understand this; I have a question.

I understand these statements are true:

1. Managed code is code that is executed by the CLR.
2. Managed code can access managed and unmanaged data.

How would I describe a C# Interrop DLL? As managed code? (It will be used by
an un-managed code (non .NET) client).

How will the DLL be used by unmanaged code? I ask because there are
inherent problems in making DLL's that will be consumed by unmanaged
applications.

In any case, an assembly (dll or exe) that is built using a managed
compiler (C++.NET, VB.NET, C#) is a managed dll containing managed code.
 
I

Ignacio Machin ( .NET/ C# MVP )

I am trying to understand this; I have a question.

I understand these statements are true:

1. Managed code is code that is executed by the CLR.
2. Managed code can access managed and unmanaged data.

How would I describe a C# Interrop DLL? As managed code? (It will be used by
an un-managed code (non .NET) client).

It;s managed IF and ONLY IF you write it in a .NET language. It's un
managed otherwise (from .NET point of view at least)
You can call a managed code (.dll) from an unmanaged one (you simply
have to select "Registry for COM Interop" option)
You can call an unmanaged dll from .NET int his case it depends of the
unmanaged code how to do it, if it's a COM dll you can simply add a
reference to it (the IDE will take care of the rest) If it's a native
DLL you have to use P/invoke
 

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