Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managed code in unmanaged

Tags:

.net

delphi

if i'm using .net dll from delphi code, by exporting types, will managed code have his own thread or it will work in delphis thread? or i must create thread in dll, if i want it to work in new thread?

i want to call .net function, from unmanaged code. and i want it to work async.

like image 285
Jack Malkovich Avatar asked Mar 05 '11 08:03

Jack Malkovich


People also ask

What is managed code and unmanaged code?

Managed code is the one that is executed by the CLR of the . NET framework while unmanaged or unsafe code is executed by the operating system. The managed code provides security to the code while undamaged code creates security threats.

What is meant by managed code?

Managed code is computer program code that requires and will execute only under the management of a Common Language Infrastructure (CLI); Virtual Execution System (VES); virtual machine, e.g. . NET, CoreFX, or . NET Framework; Common Language Runtime (CLR); or Mono. The term was coined by Microsoft.

What is the difference between managed and unmanaged codes?

The Key Difference between Managed and Unmanaged code is that Managed Code is byte code executed by a virtual machine like the . NET CLR engine. While Unmanaged code is like the C++ code output as natural OS Hardware dependent binary code executed by the Hardware machine directly.

How is managed code executed?

Managed code is a code whose execution is managed by Common Language Runtime. It gets the managed code and compiles it into machine code. After that, the code is executed. The runtime here i.e. CLR provides automatic memory management, type safety, etc.


1 Answers

The managed code will not get any new thread automatically. You need to spin of a thread yourself and call the managed code on that thread.

Of course you can use threads internally in the .NET code.

like image 178
Albin Sunnanbo Avatar answered Sep 28 '22 05:09

Albin Sunnanbo